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: wrap postMessage in timeout to prevent race conditions #143

Merged
merged 1 commit into from
Mar 27, 2024
Merged

Fix: wrap postMessage in timeout to prevent race conditions #143

merged 1 commit into from
Mar 27, 2024

Conversation

AustP
Copy link
Contributor

@AustP AustP commented Feb 27, 2024

Description

There was a race condition where sometimes Kibisis wouldn't show up in the available providers. I believe this was happening because the channel was being created and a listener was being attached and then a message was immediately being posted. I've made a change so that the message being posted happens on the next tick so it actually gives the channel time to setup.

@kieranroneill

Checklist

  • Code compiles correctly
  • Created tests which fail without the change (if possible)
  • All tests passing
  • Extended the README / documentation, if necessary

Copy link
Collaborator

@drichar drichar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have noticed this happening occasionally, and the randomness of it does suggest a race condition in the initialization logic. Have you seen this before @kieranroneill ?

The issue is sporadic to begin with... that said, I can't reproduce it with your solution. So it does seem to do the trick 👍

Thank you for the PR! Sorry about the delay reviewing this and #141

@drichar
Copy link
Collaborator

drichar commented Mar 20, 2024

This is approved but I'd like to see if @kieranroneill has any feedback about the issue before merging (ty in advance!)

@kieranroneill
Copy link
Contributor

@drichar I will have a look at this today 😊

@drichar drichar merged commit 2d18482 into TxnLab:main Mar 27, 2024
1 check passed
@AustP AustP deleted the fix/kibisis-race branch April 1, 2024 15:37
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.

3 participants