Skip to content

Fix NextID concurrency#34

Open
td0m wants to merge 1 commit intodelaneyj:mainfrom
td0m:fix/next-id-concurrency
Open

Fix NextID concurrency#34
td0m wants to merge 1 commit intodelaneyj:mainfrom
td0m:fix/next-id-concurrency

Conversation

@td0m
Copy link

@td0m td0m commented Nov 6, 2025

I discovered a bug with toolbelt.NextID(): generating a new id from two goroutines gives the same ID only if it's the first time doing so:

for range 2 {
    go func() {
        fmt.Println(tk.NextID())
    }()
}
// gives:
301691251273500107
301691251273500107

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.

1 participant