diff --git a/nsqd/guid.go b/nsqd/guid.go index 89ba83e9e..52318ee3a 100644 --- a/nsqd/guid.go +++ b/nsqd/guid.go @@ -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