Skip to content

Commit

Permalink
修改测试数据及备注
Browse files Browse the repository at this point in the history
  • Loading branch information
wby committed May 7, 2018
1 parent 921525d commit 5177869
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions snowFlake.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ const (
numberMax int64 = -1 ^ (-1 << numberBits) // 同上,用来表示生成id序号的最大值
timeShift uint8 = workerBits + numberBits // 时间戳向左的偏移量
workerShift uint8 = numberBits // 节点ID向左的偏移量
// 41位字节作为时间戳数值的话大约68年就会用完
// 假如你2010年1月1日开始开发系统如果不减去2010年1月1日的时间戳那么白白浪费40年的时间戳啊!
// 这个一旦定义且开始生成ID后千万不要改了不然可能会生成相同的ID
epoch int64 = 1525705533000 // 这个是我在写initTime这个变量时的时间戳(毫秒)
// 41位字节作为时间戳数值的话 大约68年就会用完
// 假如你2010年1月1日开始开发系统 如果不减去2010年1月1日的时间戳 那么白白浪费40年的时间戳啊!
// 这个一旦定义且开始生成ID后千万不要改了 不然可能会生成相同的ID
epoch int64 = 1525705533000 // 这个是我在写epoch这个变量时的时间戳(毫秒)
)

// 定义一个woker工作节点所需要的基本参数
Expand Down
2 changes: 1 addition & 1 deletion snowFlake_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func TestSnowFlakeByGo(t *testing.T) {
}

ch := make(chan int64)
count := 1000000
count := 10000
// 并发 count 个 goroutine 进行 snowflake ID 生成
for i := 0; i < count; i++ {
go func() {
Expand Down

0 comments on commit 5177869

Please sign in to comment.