Skip to content

fix: clear timeout handle on resolve and consolidate withRaceTimeout - #241

Merged
collinsezedike merged 2 commits into
mainfrom
fix/timeout-helper-timer-leak
Jun 25, 2026
Merged

collinsezedike merged 2 commits into
mainfrom
fix/timeout-helper-timer-leak

Conversation

@collinsezedike

@collinsezedike collinsezedike commented Jun 24, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Extracts a single withRaceTimeout helper in packages/shared that properly calls clearTimeout on both resolve and reject paths, eliminating the timer leak present in the old Promise.race pattern
  • Replaces the duplicate withSorobanTimeout in tx.ts and withTimeout in blend.ts with thin wrappers over withRaceTimeout, removing the two independent copies of the same leaky implementation
  • Adds four tests for withRaceTimeout covering the happy path, timeout path, and clearTimeout-on-resolve/reject behavior

Test plan

  • pnpm lint && pnpm typecheck && pnpm test pass locally
  • pnpm --filter @meridian/shared run test shows 14 passing (4 new)
  • pnpm --filter @meridian/stellar-sdk-helpers run test shows 80 passing

Closes #233

@vercel

vercel Bot commented Jun 24, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
meridian Ready Ready Preview, Comment Jun 25, 2026 3:55pm

@collinsezedike
collinsezedike merged commit 9b9a8e0 into main Jun 25, 2026
5 checks passed
@collinsezedike
collinsezedike deleted the fix/timeout-helper-timer-leak branch June 25, 2026 15:55

This branch was successfully deployed

1 active deployment
Preview — 723d12f4 Deployed Jun 25, 2026 by vercel[bot]
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.

[Fix] withSorobanTimeout and withTimeout leak a timer handle on every successful RPC call

1 participant