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

gloo-worker: Reactor does not send anything under heavy load #490

Open
124C41p opened this issue Aug 3, 2024 · 0 comments
Open

gloo-worker: Reactor does not send anything under heavy load #490

124C41p opened this issue Aug 3, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@124C41p
Copy link

124C41p commented Aug 3, 2024

Describe the Bug

When calling .send().await on a ReactorScope in an infinite loop, nothing is actually sent.

Steps to Reproduce

Spawn a web worker running the following loop.

#[reactor]
pub async fn Worker(mut scope: ReactorScope<(), u64>) {
    for i in 0.. {
        scope.send(i).await.unwrap();

        // Nothing is sent unless we uncomment the following line
        // gloo::timers::future::sleep(Duration::from_millis(100)).await;
    }
}

Log the output to the console from the main thread.

fn main() {
    wasm_bindgen_futures::spawn_local(async {
        let mut bridge = Worker::spawner().spawn("/worker.js");
        while let Some(i) = bridge.next().await {
            gloo::console::log!(i)
        }
    });
}

Expected Behavior

To see output on the console.

Actual Behavior

There is no output on the console. After uncommenting the sleep statement in the reactor function, the expected output appears.

Additional Context

Tested with gloo-worker v0.5.0 inside Firefox dev edition 128.0b3.

@124C41p 124C41p added the bug Something isn't working label Aug 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant