diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/service/pow/PoWPublishQueue.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/service/pow/PoWPublishQueue.kt index 33b46a9e60..7ea4cc6bac 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/service/pow/PoWPublishQueue.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/service/pow/PoWPublishQueue.kt @@ -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 {