Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nsqd: make the GUID code a bit more robust #587

Merged
merged 2 commits into from
May 9, 2015
Merged

Conversation

mpe
Copy link
Contributor

@mpe mpe commented May 9, 2015

This isn't passing travis on my repo, but not sure why, it's not building at all.

mpe added 2 commits May 9, 2015 16:08
The way the GUID is constructed should ensure that we never return an ID
that is less than or equal than the previous ID. So add code to track
that and return an error if we ever violate that condition.
Because lastError is initialised to time.Now(), a full second must
elapse before we'll print an error. If an error is returned at least
once a second after that, we'll never print an error.

Instead we can initialise lastError to the UNIX Epoch timestamp, meaning
the first error we see will generate an error message.
@mreiferson
Copy link
Member

LGTM, thanks!

mreiferson added a commit that referenced this pull request May 9, 2015
Make the GUID code a bit more robust
@mreiferson mreiferson merged commit d28cfc7 into nsqio:master May 9, 2015
@mreiferson mreiferson changed the title Make the GUID code a bit more robust nsqd: make the GUID code a bit more robust May 9, 2015
@mpe mpe deleted the guid branch May 11, 2015 02:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants