diff --git a/Sources/InfomaniakCore/SuddenTermination/ExpiringActivity.swift b/Sources/InfomaniakCore/SuddenTermination/ExpiringActivity.swift index 30c1c1e..393d117 100644 --- a/Sources/InfomaniakCore/SuddenTermination/ExpiringActivity.swift +++ b/Sources/InfomaniakCore/SuddenTermination/ExpiringActivity.swift @@ -109,6 +109,11 @@ public final class ExpiringActivity: ExpiringActivityable { if shouldTerminate { self.shouldTerminate = true delegate?.backgroundActivityExpiring() + + // At this point we should release the block, but we prefer to wait until the end 🫡⛵️🪦 + // There is a chance endAll() is called while we wait in should terminate + group.wait() + return } group.enter()