-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix NewULID for systems with low time resolution (#270)
NewULID uses a pool of rand.Source using time.Now() as seed. In some systems with high concurrency and lower time resolution, this leads to multiple sources with the same sead, making NewULID return equal values on subsequent calls. This commit changes the seed to add a random number from the global shared rand.Source (which is thread-safe). Signed-off-by: Santiago M. Mola <[email protected]>
- Loading branch information
Showing
2 changed files
with
30 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters