Delete all alarms on abortAllDurableObjects()#1918
Conversation
|
is there a reason why this PR was not merged, it would help solve the known issue of vitest integration ? If necessary I can reopen a similar PR rebased on latest master if @mrbbot has not the time ? |
4858383 to
114b466
Compare
21f19cb to
cf82243
Compare
cf82243 to
0aa0611
Compare
Merging this PR will improve performance by 26.77%
Performance Changes
Comparing Footnotes
|
Removed section on Durable Object alarms from known issues. cloudflare/workerd#1918
|
Ironically, a week after this PR was merged, vitest-pool-workers actually removed its usage of this API. After two years of waiting... And after some discussion, we feel that it doesn't make sense for abortAllDurableObjects() to cancel alarms. Cancelling alarms is essentially deleting data from the DOs, but since it doesn't delete all data, it leaves them in an inconsistent state. It could make sense to add a new deleteAllDurableObjects() API which aborts DOs, cancels alarms, and deletes underlying data, but that should be a separate API. In any case I will be rolling this back as it is blocking #6104. |
Fixes cloudflare/workers-sdk#5388
In the Workers Vitest integration, we call the
abortAllDurableObjects()function after each test to abort all Durable Objects and close all SQLite databases. If the isolated storage option is enabled, we backup/restore.sqlitefiles to automatically undo writes performed in tests. Right now, this doesn't cancel Durable Object alarms. This means that an alarm scheduled in one test might end up firing when another later test is running. This could lead to unexpected test results, and non-determinism in tests.This PR addresses this issue by automatically deleting all Durable Object alarms when
abortAllDurableObjects()is called. This is a local-only internal API that's currently only used in the Vitest integration, so making this breaking change is fine. 👍