Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Conversation

1abhishekpandey
Copy link
Contributor

@1abhishekpandey 1abhishekpandey commented Jul 5, 2024

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)
#417

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • Version upgraded (project, README, gradle, podspec etc)
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added unit tests for the code
  • I have made corresponding changes to the documentation

@1abhishekpandey 1abhishekpandey self-assigned this Jul 5, 2024
@1abhishekpandey 1abhishekpandey marked this pull request as ready for review July 8, 2024 08:50
@1abhishekpandey 1abhishekpandey requested a review from a team as a code owner July 8, 2024 08:50
ChryssaAliferi
ChryssaAliferi previously approved these changes Jul 9, 2024
Copy link

@1abhishekpandey 1abhishekpandey merged commit 0711b37 into develop Jul 29, 2024
14 checks passed
@1abhishekpandey 1abhishekpandey deleted the feature/sdk-2114-improve-the-idle-thread-sleep-functionality-for branch July 29, 2024 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG : Profiler reports high CPU usage even in background
2 participants