Skip to content

fix: unused client timeout and pending-request leak#33

Open
Anshumancanrock wants to merge 2 commits intoContextVM:mainfrom
Anshumancanrock:fix/client-timeout-pending-cleanup
Open

fix: unused client timeout and pending-request leak#33
Anshumancanrock wants to merge 2 commits intoContextVM:mainfrom
Anshumancanrock:fix/client-timeout-pending-cleanup

Conversation

@Anshumancanrock
Copy link
Copy Markdown

Summary

Implement client-side request timeout handling in NostrClientTransport.

Issue

The timeout config and constant were defined but not used, so missing responses left pending entries forever and never surfaced timeout errors.

What is Changed

  • Wired NostrClientTransportConfig.timeout default to DEFAULT_TIMEOUT_MS
  • Replaced pending request tracking from HashSet to timestamped map.
  • Added periodic timeout sweep in the client event loop to evict stale pending requests.
  • Emit JSON-RPC timeout error responses using Error::Timeout when requests expire.
  • Improved event-loop resilience by handling lagged notification streams without exiting.
  • Added focused tests for timeout default wiring, stale cleanup, boundary expiry, and timeout error shape.

@ContextVM-org
Copy link
Copy Markdown
Collaborator

This looks good, but before we can continue with this please check the rmpc sdk which will probably handle timeouts by itself so we dont have redundant code and hardcoded error codes. Also this behaviour should be symmetric in the server. There are also some conflicts.
So in resume. Before continue please check how the rmcp sdk handles timesout so we can understand how we should implement this

@ContextVM-org
Copy link
Copy Markdown
Collaborator

Do you plan to keep working on this or can we close this pr? @Anshumancanrock

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