-
-
Notifications
You must be signed in to change notification settings - Fork 904
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
v7: passing options.msecs
results in zero-value timestamp
#764
Comments
uuid.v7
: is it possible to specify only the msecs
option?options.msecs
results in zero-value timestamp
@pmccarren I've confirmed this is an issue. I think this occurs because the timestamp field is set from the internal Can you take a look? |
TL;DR: Providing any custom
|
@robinpokorny All good points, and thanks for putting that test together. This does raise a couple questions that I don't have good answers to at the moment: Should IDs generated with user-supplied It's been a good while since I gave any thought to this aspect of the Where user-provided options overlap with internal state, do they represent the state prior to UUID generation or the state reflected in the generated UUID? |
I created a PR that fixes the main issue.
We should support generation of multiple UUIDs within the same millisecond that was user-provided. Ideally with monotonicity. One example is backfilling. Current time is then treated as a default and does not have a special treating. One unsolved (and probably unsolvable) case is when the the function is called by alternating timestamps. Then each time it's treated as the first and monotonicity is lost. I can imagine this can happen as this library is quite popular so multiple sources can call it simultaneously. I wrote about this in the original PR (point 5): #681 (comment) |
Co-authored-by: Robert Kieffer <robert@broofa.com> Co-authored-by: Robin Pokorny <me@robinpokorny.com>
Co-authored-by: Robert Kieffer <robert@broofa.com> Co-authored-by: Robin Pokorny <me@robinpokorny.com>
Co-authored-by: Robert Kieffer <robert@broofa.com> Co-authored-by: Robin Pokorny <me@robinpokorny.com>
In
uuid.v7
, when themsecs
option is specified without theseq
option, the timestamp becomes nil despite being a value greater than 0. Is this intentional behavior? From what I can see in the implementation, it appears thatuuid.v7
tries to manage the monotonic sequence counter unless it is specified as an option.Example:
Addition 2 days after issue creation:
Since the bug label was added, I am updating the information based on the ISSUE_TEMPLATE.
Description of the problem
Please refer to the above.
Recipe for reproducing
Please refer to the "Example:" above.
Additional information
N/A
Environment
The text was updated successfully, but these errors were encountered: