mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-10-06 11:48:24 +00:00
fix(pow): drop checkpoint before removing job from the jobs flow
removeEntry published the empty jobs list before calling persistence.remove, so an observer waking on the job's disappearance (e.g. PoWPublishQueueTest.persistedJobIsSavedThenRemovedOnCompletion) could still see the checkpoint. Remove the checkpoint first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MKvUGSMiCwjSdVm33hD4yp
This commit is contained in:
+3
-1
@@ -476,9 +476,11 @@ class PoWPublishQueue(
|
||||
dropCheckpoint: Boolean,
|
||||
persisted: Boolean,
|
||||
) {
|
||||
// drop the checkpoint before the entry leaves [jobs]: anyone observing
|
||||
// the job disappear must also see its checkpoint gone.
|
||||
if (persisted && dropCheckpoint) persistence?.remove(jobId)
|
||||
pending.update { it.removing(jobId) }
|
||||
_jobs.update { list -> list.filter { it.id != jobId }.toImmutableList() }
|
||||
if (persisted && dropCheckpoint) persistence?.remove(jobId)
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
Reference in New Issue
Block a user