Skip to content

Commit

Permalink
fix: fetch initial toggles and return
Browse files Browse the repository at this point in the history
  • Loading branch information
FredrikOseberg committed Jan 24, 2025
1 parent 24032bf commit 96aeaaf
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Sources/UnleashProxyClientSwift/Poller/Poller.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@ public class Poller {
context: Context,
completionHandler: ((PollerError?) -> Void)? = nil
) -> Void {
if self.refreshInterval == 0 {
return
}


if toggles.isEmpty {
self.getFeatures(context: context, completionHandler: completionHandler)
} else {
Expand All @@ -56,6 +53,10 @@ public class Poller {
completionHandler?(nil)
}

if self.refreshInterval == 0 {
return
}

let timer = Timer.scheduledTimer(withTimeInterval: Double(self.refreshInterval ?? 15), repeats: true) { timer in
self.getFeatures(context: context)
}
Expand Down

0 comments on commit 96aeaaf

Please sign in to comment.