exponea/exponea-ios-sdk

Multiple flush timers

Closed this issue · 2 comments

yalp commented

Hi, I'm using the periodic flush (every 5s) and getting a lot of "Flushing data" logs (in verbose):

2023-08-29 12:27:38748 ExponeaSDK ℹ️ VERBOSE [FlushingManager.swift]:114 flushData(completion:): Flushing data: 0 total objects to upload, 0 events and 0 customer updates.
2023-08-29 12:27:39307 ExponeaSDK ℹ️ VERBOSE [FlushingManager.swift]:114 flushData(completion:): Flushing data: 0 total objects to upload, 0 events and 0 customer updates.
2023-08-29 12:27:40664 ExponeaSDK ℹ️ VERBOSE [FlushingManager.swift]:114 flushData(completion:): Flushing data: 0 total objects to upload, 0 events and 0 customer updates.
2023-08-29 12:27:43747 ExponeaSDK ℹ️ VERBOSE [FlushingManager.swift]:114 flushData(completion:): Flushing data: 0 total objects to upload, 0 events and 0 customer updates.
2023-08-29 12:27:44306 ExponeaSDK ℹ️ VERBOSE [FlushingManager.swift]:114 flushData(completion:): Flushing data: 0 total objects to upload, 0 events and 0 customer updates.
2023-08-29 12:27:45664 ExponeaSDK ℹ️ VERBOSE [FlushingManager.swift]:114 flushData(completion:): Flushing data: 0 total objects to upload, 0 events and 0 customer updates.
2023-08-29 12:27:48746 ExponeaSDK ℹ️ VERBOSE [FlushingManager.swift]:114 flushData(completion:): Flushing data: 0 total objects to upload, 0 events and 0 customer updates.
2023-08-29 12:27:49306 ExponeaSDK ℹ️ VERBOSE [FlushingManager.swift]:114 flushData(completion:): Flushing data: 0 total objects to upload, 0 events and 0 customer updates.
2023-08-29 12:27:50663 ExponeaSDK ℹ️ VERBOSE [FlushingManager.swift]:114 flushData(completion:): Flushing data: 0 total objects to upload, 0 events and 0 customer updates.
2023-08-29 12:27:53747 ExponeaSDK ℹ️ VERBOSE [FlushingManager.swift]:114 flushData(completion:): Flushing data: 0 total objects to upload, 0 events and 0 customer updates.
2023-08-29 12:27:54306 ExponeaSDK ℹ️ VERBOSE [FlushingManager.swift]:114 flushData(completion:): Flushing data: 0 total objects to upload, 0 events and 0 customer updates.
2023-08-29 12:27:55664 ExponeaSDK ℹ️ VERBOSE [FlushingManager.swift]:114 flushData(completion:): Flushing data: 0 total objects to upload, 0 events and 0 customer updates.
2023-08-29 12:27:58746 ExponeaSDK ℹ️ VERBOSE [FlushingManager.swift]:114 flushData(completion:): Flushing data: 0 total objects to upload, 0 events and 0 customer updates.
2023-08-29 12:27:59306 ExponeaSDK ℹ️ VERBOSE [FlushingManager.swift]:114 flushData(completion:): Flushing data: 0 total objects to upload, 0 events and 0 customer updates.
2023-08-29 12:28:00664 ExponeaSDK ℹ️ VERBOSE [FlushingManager.swift]:114 flushData(completion:): Flushing data: 0 total objects to upload, 0 events and 0 customer updates.

This seems related to startPeriodicFlushTimer() not checking if timer is already stopped before restarting a new one.

And the timer is started on applicationDidBecomeActive() but only stopped on applicationDidEnterBackground() which are not symmetrical events (applicationDidEnterForeground is) so at one point there will be multiple timers.

Hi @yalp , we fixed it in v2.19.0

yalp commented

Thanks !