Skip to content

Commit 6bc0ed5

Browse files
alanjcharlesbsneed
andauthored
Initial state is attempting to be accessed prior to completion. (#289)
Co-authored-by: Brandon Sneed <[email protected]>
1 parent cefc56b commit 6bc0ed5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Sources/Segment/Utilities/Policies/IntervalBasedFlushPolicy.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ public class IntervalBasedFlushPolicy: FlushPolicy,
3939
self.analytics?.store.subscribe(self, initialState: true) { [weak self] (state: System) in
4040
guard let self = self else { return }
4141
guard let a = self.analytics else { return }
42-
self.flushTimer = QueueTimer(interval: a.configuration.values.flushInterval) { [weak self] in
42+
guard let system: System = a.store.currentState() else { return }
43+
self.flushTimer = QueueTimer(interval: system.configuration.values.flushInterval) { [weak self] in
4344
self?.analytics?.flush()
4445
}
4546
}

0 commit comments

Comments
 (0)