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

Fix: Ensure Unique AdmnMessageID() Generation #59

Closed
wants to merge 1 commit into from

Conversation

mohdjishin
Copy link

@mohdjishin mohdjishin commented Mar 14, 2024

Updated the AlphaSerialNumber function to guarantee unique message ID generation even when multiple IDs are created simultaneously. By eliminating the dependency on the current time, this fix ensures that message IDs remain distinct regardless of generation timing. This adjustment mitigates potential conflicts in message identification. This function is called inside AdmnMessageID(). (The issue will occur when you have two sets of queues and you are trying to echo at the same time in both queues. Generated message IDs will be exactly the same if they depend on time.)

Revised AlphaSerialNumber function to guarantee unique message ID generation even when multiple IDs are created at the same time. By eliminating the dependency on the current time, this fix ensures that message IDs remain distinct regardless of generation timing. This adjustment enhances system robustness and mitigates potential conflicts in message identification.
@adamdecaf
Copy link
Member

I like this, but we knew that time based sequences will conflict. Random numbers will still conflict and will produce out-of-sequence values, which may be unexpected. Perhaps we offer a version of these ID functions which take a generator function.

@adamdecaf
Copy link
Member

Thanks for opening these PR's. I've opened #61 which is a bit more generic and applies to every serial number as they all need this fix. I've included a serial generator using crypto/rand as well.

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