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

encode now-timestamps properly to avoid overwrites #62

Merged
merged 1 commit into from
Nov 15, 2019

Conversation

hackergrrl
Copy link
Member

What was happening was that when a timestamp, which are
monotonic-timestamps, included an e.g. ".001" suffix, it would be
considered as "in the future" if the indexer was quick enough to pick it
up, and then be converted to "new Date().getTime()". So if two messages
were written to a channel fast enough, BOTH would get set to "new
Date().getTime()" and the second would overwrite the first in leveldb.

This change ensures that proper monotonic-timestamps are used
throughout.

What was happening was that when a timestamp, which are
monotonic-timestamps, included an e.g. ".001" suffix, it would be
considered as "in the future" if the indexer was quick enough to pick it
up, and then be converted to "new Date().getTime()". So if two messages
were written to a channel fast enough, BOTH would get set to "new
Date().getTime()" and the second would overwrite the first in leveldb.

This change ensures that proper monotonic-timestamps are used
throughout.
@hackergrrl hackergrrl merged commit c5348c7 into master Nov 15, 2019
@cblgh
Copy link
Member

cblgh commented Nov 16, 2019

🙌

@cblgh cblgh deleted the mono-timestamps branch April 18, 2020 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants