Skip to content

Commit 69ddc06

Browse files
nan-liclaude
andcommitted
Fix FAIL_PAUSE_OPREPO hanging enqueueAndWait callers
When an operation execution returns FAIL_PAUSE_OPREPO, the repo is paused and the ops are re-queued with their original waiters still attached. enqueueAndWait callers (loginSuspend) would suspend on the waiter forever — the op stays in the queue but never executes while paused, and the waiter is never woken. Wake the waiter with false and re-queue with waiter=null, matching the pattern from #2600. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent e1a8417 commit 69ddc06

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

  • OneSignalSDK/onesignal/core/src/main/java/com/onesignal/core/internal/operations/impl

OneSignalSDK/onesignal/core/src/main/java/com/onesignal/core/internal/operations/impl/OperationRepo.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,9 +333,15 @@ internal class OperationRepo(
333333
Logging.error("Operation execution failed with eventual retry, pausing the operation repo: $operations")
334334
// keep the failed operation and pause the operation repo from executing
335335
paused = true
336-
// add back all operations to the front of the queue to be re-executed.
336+
// Unblock any enqueueAndWait callers so loginSuspend doesn't hang.
337+
ops.forEach { it.waiter?.wake(false) }
338+
// Re-queue with waiter = null: the operation is preserved for retry
339+
// on next cold start, but the original waiter is detached since it
340+
// was already woken above.
337341
synchronized(queue) {
338-
ops.reversed().forEach { queue.add(0, it) }
342+
ops.reversed().forEach {
343+
queue.add(0, OperationQueueItem(it.operation, waiter = null, bucket = it.bucket, retries = it.retries))
344+
}
339345
}
340346
}
341347
}

0 commit comments

Comments
 (0)