@@ -84,31 +84,27 @@ suspend fun Analytics.checkSettings() {
84
84
val writeKey = configuration.writeKey
85
85
val cdnHost = configuration.cdnHost
86
86
87
- store.currentState(System ::class ) ? : return
88
- store.dispatch(System .ToggleRunningAction (running = false ), System ::class )
87
+ pauseEventProcessing()
89
88
90
- withContext(networkIODispatcher) {
89
+ val settingsObj = withContext(networkIODispatcher) {
91
90
log(" Fetching settings on ${Thread .currentThread().name} " )
92
- val settingsObj: Settings ? = fetchSettings(writeKey, cdnHost)
93
-
94
- withContext(analyticsDispatcher) {
95
-
96
- settingsObj?.let {
97
- log(" Dispatching update settings on ${Thread .currentThread().name} " )
98
- store.dispatch(System .UpdateSettingsAction (settingsObj), System ::class )
99
- }
91
+ return @withContext fetchSettings(writeKey, cdnHost)
92
+ }
100
93
101
- store.currentState(System ::class )?.let { system ->
102
- system.settings?.let { settings ->
103
- log(" Propagating settings on ${Thread .currentThread().name} " )
104
- update(settings)
105
- }
106
- }
94
+ settingsObj?.let {
95
+ log(" Dispatching update settings on ${Thread .currentThread().name} " )
96
+ store.dispatch(System .UpdateSettingsAction (settingsObj), System ::class )
97
+ }
107
98
108
- // we're good to go back to a running state.
109
- store.dispatch(System .ToggleRunningAction (running = true ), System ::class )
99
+ store.currentState(System ::class )?.let { system ->
100
+ system.settings?.let { settings ->
101
+ log(" Propagating settings on ${Thread .currentThread().name} " )
102
+ update(settings)
110
103
}
111
104
}
105
+
106
+ // we're good to go back to a running state.
107
+ resumeEventProcessing()
112
108
}
113
109
114
110
internal fun Analytics.fetchSettings (
0 commit comments