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

TestWorkerPostMessage/listen_after_post won't work #5

Open
magodo opened this issue Aug 31, 2023 · 0 comments
Open

TestWorkerPostMessage/listen_after_post won't work #5

magodo opened this issue Aug 31, 2023 · 0 comments

Comments

@magodo
Copy link

magodo commented Aug 31, 2023

Thank you for this awesome wrapper around the web worker API 👍

I've tried to played around this and probably found a bug, that the test case TestWorkerPostMessage/listen_after_post acutally won't work if there introduced a swap point, e.g. if I add a time.Sleep right before the listening on the controling script side, the test will hang:

Adding time.Sleep(time.Second) above L284

ctx, cancel := context.WithCancel(context.Background())
t.Cleanup(cancel)
messages, err := worker.Listen(ctx)
if err != nil {
t.Fatal(err)
}

I've also noticed the same thing happens on the worker side, where if the worker starts to listen after the controller have sent the msg, then those msg will not be available in the event channel.

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

No branches or pull requests

1 participant