Skip to content

Commit

Permalink
nsqd:It is more efficient to deal with the case where the sequence is…
Browse files Browse the repository at this point in the history
… used up here
  • Loading branch information
gueFDF committed Apr 26, 2023
1 parent cfbd287 commit 34f2e70
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion nsqd/guid.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ func (f *guidFactory) NewGUID() (guid, error) {
f.sequence = (f.sequence + 1) & sequenceMask
if f.sequence == 0 {
f.Unlock()
return 0, ErrSequenceExpired
//wait for next millisecond
for ts <= f.lastTimestamp {
ts = time.Now().UnixNano() >> 20
}
}
} else {
f.sequence = 0
Expand Down

0 comments on commit 34f2e70

Please sign in to comment.