Menu

1 / 11

Workflows that survive a closed tab: durable waits with checkpoints and chrome.alarms

DEV Community: javascript·Dannick Kwengang·about 7 hours ago
#lNNGer86
#devtojavascript#devto#dev#node#resume
Reading 0:00
15s threshold

"Browser automation dies when you close the tab" is the standard objection to running workflows in an extension. For a while it was true for AWFlow too: a workflow with a "wait 3 days, then check again" step only worked if you left a tab open for three days.

This post is about how runs can now pause for up to 30 days, survive a closed tab, a browser restart or an extension update, and resume where they stopped . It's the same mechanism that lets a run pause for a human approval.

Flip it. Save the run, let the browser wake it.

The constraint: MV3 has no long-lived process

In Manifest V3 the background is a service worker, and Chrome suspends it when it's idle. setTimeout(resume, 3 * DAY) is useless there: the worker is gone long before the timer fires. The page that runs the engine (the extension's app tab) can be closed by the user at any time.

Memory is the problem.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.