summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2019-08-14 15:23:53 +0300
committerAndrej Mihajlov <and@mullvad.net>2019-08-14 15:23:53 +0300
commit0786b076f1cd92f9c2b79b000929248e098cf677 (patch)
treef4b0f4bbc913ad7e78222b304122fec5dab732c2
parentaf906b4fc09a6acbf52aaf396d7104466b4de3c4 (diff)
parent62e5df0163245e5ad403059287c3049606e61096 (diff)
downloadmullvadvpn-0786b076f1cd92f9c2b79b000929248e098cf677.tar.xz
mullvadvpn-0786b076f1cd92f9c2b79b000929248e098cf677.zip
Merge branch 'fix-add-observer-bug'
-rw-r--r--ios/MullvadVPN/AccountExpiryRefresh.swift8
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())
+ }
}
}