-
Notifications
You must be signed in to change notification settings - Fork 216
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
Allow async methods on worker proxy #7088
Conversation
Please explain use case. await workerProxy.someLongRunningAsyncOperation();
await workerProxy.someFastSynchronousOperation(); the first operation always completes before the second. |
Co-authored-by: Paul Connelly <22944042+pmconne@users.noreply.github.com>
Could you explain what you have in mind with this test? javascript 'await' contract is "to wait for a promise and get its fulfillment value" so the second line will never execute before the first one has ended. |
No, it doesn't block the JS event loop, it yields to the JS event loop. I asked about use cases because in some cases it may be important that operations execute in sequence - e.g., "first pass some data to be processed, then invoke an operation to process that data". In others, it may not matter (e.g., "perform this atomic operation and return the result"). Yours sounds like the latter? |
From now, it's the latter, I'm expecting to make atomic requests so sequence is not important. I updated the test and the message queue does not seem to produce a FIFO result. |
You're testing the opposite of what I suggested, which is fine, but different. |
Co-authored-by: Mathieu Marchand <matmarchand@users.noreply.github.com> Co-authored-by: Paul Connelly <22944042+pmconne@users.noreply.github.com>
Co-authored-by: Mathieu Marchand <matmarchand@users.noreply.github.com> Co-authored-by: Paul Connelly <22944042+pmconne@users.noreply.github.com>
Adding async support to enable worker proxy so we can run async operation like fetch(). In my case, it is a large geojson stream that would like to avoid moving from the the main thread to the worker thread.