Extend PromiseWorker to support asynchronously executing workers

NEW
Assigned to

Status

()

P1
normal
4 months ago
4 months ago

People

(Reporter: dthayer, Assigned: dthayer)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

4 months ago
If we want to do asynchronous work inside of a worker right now, we can't use a PromiseWorker. The worker/PromiseWorker.js code expects the dispatch(...) function to immediately return a value, and BasePromiseWorker implements the request ids as simply a debug check on its queue-based message processing.

We should use a Map of id's to handlers instead of a queue, and allow returning a promise inside the worker code itself.

Comment 1

4 months ago
P1'ing given this has an assignee. :-)
Priority: -- → P1
(Assignee)

Comment 2

4 months ago
Right now PromiseWorker supports an async interface on the
consumer side, but the worker code itself can't be async. This
can be a barrier for bringing certain things (see Bug 1502146
easily into a worker).
You need to log in before you can comment on or make changes to this bug.