diff options
| -rw-r--r-- | ios/MullvadVPN/AccountExpiryRefresh.swift | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/ios/MullvadVPN/AccountExpiryRefresh.swift b/ios/MullvadVPN/AccountExpiryRefresh.swift index 14feadccd1..c6b1c6278b 100644 --- a/ios/MullvadVPN/AccountExpiryRefresh.swift +++ b/ios/MullvadVPN/AccountExpiryRefresh.swift @@ -43,11 +43,13 @@ class AccountExpiryRefresh { /// Register observer and start updating the account expiry if hasn't started yet private func addObserver(_ observer: Observer) { lock.withCriticalScope { - if observers.isEmpty { - procedureQueue.addOperation(makePeriodicUpdateProcedure()) - } + let wasEmpty = observers.isEmpty observers.append(WeakBox(observer)) + + if wasEmpty { + procedureQueue.addOperation(makePeriodicUpdateProcedure()) + } } } |
