rudderlabs / rudder-sdk-android

Android SDK for RudderStack - the Customer Data Platform for Developers.
https://www.rudderstack.com
Other
18 stars 29 forks source link

feat: add a configurable setting to put the CloudModeProcessor to sleep for a specified interval #460

Closed 1abhishekpandey closed 2 months ago

1abhishekpandey commented 3 months ago

Description

Added a builder method withEventDispatchSleepInterval(int eventDispatchSleepInterval) that allows users to configure the sleep interval for the CloudModeProcessor when it is idle (i.e., no events to process). The default interval is 1 second, ensuring no change in existing behaviour. This feature enables users to conserve battery by putting the CloudModeProcessor thread to sleep for a specified interval.

Also, note that the value specified in withEventDispatchSleepInterval(...) should not exceed the sleepTimeOut value; otherwise, the default value of 1 second will be used.

NOTE: Currently, the default behaviour dictates that if there are no events to process, the CloudModeProcessor checks every 1 second for new events in the database. This ensures prompt event delivery. Once the user changes this default setting, the thread will sleep for a specified interval before checking the database again for new events.

Fixes # (issue) https://github.com/rudderlabs/rudder-sdk-android/issues/417

Type of change

sonarcloud[bot] commented 2 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud