Skip to content

TestWorkerPostMessage/listen_after_post won't work #5

@magodo

Description

@magodo

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.

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