Skip to content

truapi-server: replace std::thread::spawn per subscription with a proper executor #97

Closed

Description

@pgherveou

Found during review of #96. rust/crates/truapi-server/src/subscription.rs spawns one OS thread per active subscription via std::thread::spawn(move || futures::executor::block_on(future)). Subscriptions are long-lived (chain follow, statement-store subscribe, account connection status) so this leaks one thread per stream on native and panics on wasm32 (which has no threads, the file currently has no cfg gate). Fix: drive subscriptions via the dispatcher's own executor — tokio LocalSet on the ws-bridge, wasm-bindgen-futures spawn on wasm, an injected executor handle on UniFFI hosts.

Activity

  1. pgherveou commented on Jun 29, 2026

    @pgherveou
    CollaboratorAuthor

    Closing this generated tracking issue as covered by PR #104 and its review follow-ups.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions