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(bonsai-core): work around indexer race condition by managing websocket value lifecycles more clearly #1420

Merged
merged 3 commits into from
Jan 9, 2025

Conversation

tyleroooo
Copy link
Contributor

@tyleroooo tyleroooo commented Jan 9, 2025

Now we keep all subscriptions open for an extra 20 seconds to prevent churn. Before if you flipped back and forth quickly (sub, unsub, resub) you'd run into weird race conditions and break things. Now when you unsub we hold onto that subscription for 20 seconds and then destroy it. If you re-sub before destruction we just hand you back the sub we kept around.

@tyleroooo tyleroooo requested a review from a team as a code owner January 9, 2025 20:19
Copy link

vercel bot commented Jan 9, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
v4-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 9, 2025 10:35pm
v4-testnet ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 9, 2025 10:35pm

@@ -229,16 +233,15 @@ export function setUpParentSubaccount(store: RootStore) {
if (!isTruthy(wallet) || subaccount == null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

lint warnings here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah I like being extra safe with this one even though technically it can't be null

@tyleroooo tyleroooo enabled auto-merge (squash) January 9, 2025 22:34
@tyleroooo tyleroooo merged commit 31ad327 into main Jan 9, 2025
8 checks passed
@tyleroooo tyleroooo deleted the tu/fix-race-condition branch January 9, 2025 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants