Skip to content

TestWorkerPostMessage/listen_after_post won't work聽#5

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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