Skip to content

Commit

Permalink
Minor cosmetic updates
Browse files Browse the repository at this point in the history
  • Loading branch information
mxmlkzdh committed Sep 12, 2024
1 parent d4c97f6 commit fad4524
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ The SnowMint server accepts the following optional command line arguments:

`--node` The server's node ID between 0 and 31 (default: 0)

`--epoch` Your organization's epoch in milliseconds (default: 0 _Wednesday, December 31, 1969 7:00:00 PM_)
`--epoch` Your organization's epoch in milliseconds (default: 0 _Thursday, January 01 1970 00:00:00.00 GMT+0000_)

Note that in distributed systems, it is **crucial** that all instances of SnowMint servers are started with the same `epoch`.

Expand Down
2 changes: 1 addition & 1 deletion internal/id/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func NewUniqueIDGenerator(dataCenterID, nodeID int, epoch int64) (*UniqueIDGener
if epoch < 0 {
return nil, fmt.Errorf("epoch cannot be less than 0")
}
log.Printf("Unique ID generator created with dataCenterID: %d, nodeID: %d, epoch: %d", dataCenterID, nodeID, epoch)
log.Printf("unique id generator created with dataCenterID: %d, nodeID: %d, epoch: %d (%s)", dataCenterID, nodeID, epoch, time.UnixMilli(epoch))
return &UniqueIDGenerator{config: config{dataCenterID, nodeID, epoch}}, nil
}

Expand Down
2 changes: 1 addition & 1 deletion internal/id/generator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func TestNewUniqueIDGenerator(t *testing.T) {
{"Too_Large_Node_ID", 0, 32, 0, nil, true},
{"Negative_Epoch", 0, 0, -1, nil, true},
{"Default", 0, 0, 0, &UniqueIDGenerator{}, false},
{"Default", 11, 17, 946684800000, &UniqueIDGenerator{config: config{11, 17, 946684800000}}, false},
{"Created", 11, 17, 946684800000, &UniqueIDGenerator{config: config{11, 17, 946684800000}}, false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down

0 comments on commit fad4524

Please sign in to comment.