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

XADD uses seconds since epoch instead of milliseconds since epoch #151

Closed
alexporter8013 opened this issue May 18, 2023 · 0 comments · Fixed by #152
Closed

XADD uses seconds since epoch instead of milliseconds since epoch #151

alexporter8013 opened this issue May 18, 2023 · 0 comments · Fixed by #152
Labels
bug Something isn't working

Comments

@alexporter8013
Copy link
Contributor

Describe the bug
A clear and concise description of what the bug is.
Add the code you are trying to run, the stacktrace you are getting and anything else that might help.

To Reproduce
Steps to reproduce the behavior:

  1. Use xadd and inspect return value.

Expected behavior
From https://redis.io/commands/xadd/:

Both quantities are 64-bit numbers. When an ID is auto-generated, the first part is the Unix time in milliseconds of the Redis instance generating the ID. The second part is just a sequence number and is used in order to distinguish IDs generated in the same millisecond.

Source Code

Link: https://github.com/cunla/fakeredis-py/blob/053ae9e5805527f6d6dc4c1acc269226c0c7ca58/fakeredis/_stream.py#LL51C13-L51C46

Repeated for clarity:
ts, seq = int(time.time() + 1), 0

@alexporter8013 alexporter8013 added the bug Something isn't working label May 18, 2023
cunla added a commit that referenced this issue May 19, 2023
* Fixed xadd timestamp
* Add test for redis7+
Fix #151
---------

Co-authored-by: Daniel M <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant