Skip to content

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

@pgherveou

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions