-
Notifications
You must be signed in to change notification settings - Fork 15
Closed
Description
The second argument to handlers (both queue and flow based) should accept a "context" object.
This is intended for few custom utilities and be extendable in future for user-defined api clients and stuff.
But the first implementation should just pass abortSignal so users can pass it to fetch and other abortable calls to gracefully abort when worker is shutting down.
This signal should be composed of the main shutdown signal AND message-specific timeout signal using AbortSignal.any() so we can also timeout handlers properly.
Proposed api:
queue worker:
EdgeWorker.start(async (payload, { abortSignal }) => {
// do stuff and optionally abort
});flow worker:
.step(
{ slug: "website", timeout: 30 },
async (input, { abortSignal }) => {
// do stuff and optionally abort
})cpursley