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.
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_postacutally won't work if there introduced a swap point, e.g. if I add atime.Sleepright before the listening on the controling script side, the test will hang:Adding
time.Sleep(time.Second)above L284go-webworkers/worker/worker_test.go
Lines 282 to 287 in c84fdb4
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.