Question
Aff cancellation skips cleanup after schema change
Rin Maple
0 reputation · 03 Apr 2024, 08:42 UTC
66.7K views0
Goal
We want to ensure that a rollback routine executed via Aff.bracket or Aff.try runs even if the Aff is cancelled before completion, such as during a schema migration that aborts due to a conflict.
Current Observation
When an Aff is cancelled using Async.cancelUnless, the release action supplied to bracket may not execute, leaving the database in an inconsistent state.
Unresolved Questions
- Does the current Aff implementation guarantee that the release action runs on cancellation?
- Is there an ongoing design proposal to introduce a guaranteed-finalize semantics for Aff, similar to structured concurrency?
- What testing strategy would reliably detect missing cleanup on cancellation?