Skip to content

Conversation

@jamesarich
Copy link
Collaborator

This refactors DataStore and Radio coroutine scope management to improve robustness and efficiency.

In RadioInterfaceService, the serviceScope now uses a SupervisorJob instead of a Job. This prevents the failure of one child coroutine from canceling the entire scope, which is critical when the service starts a new interface.

In DataStoreModule, a single CoroutineScope with a SupervisorJob is now provided as a singleton (@DataStoreScope). This shared scope is injected into all DataStore providers, eliminating the creation of a new scope for each DataStore instance. This reduces resource overhead and centralizes scope management for data persistence operations.

…o scopes

This commit refactors coroutine scope management to improve robustness and efficiency.

In `RadioInterfaceService`, the `serviceScope` now uses a `SupervisorJob` instead of a `Job`. This prevents the failure of one child coroutine from canceling the entire scope, which is critical when the service starts a new interface.

In `DataStoreModule`, a single `CoroutineScope` with a `SupervisorJob` is now provided as a singleton (`@DataStoreScope`). This shared scope is injected into all DataStore providers, eliminating the creation of a new scope for each DataStore instance. This reduces resource overhead and centralizes scope management for data persistence operations.

Signed-off-by: James Rich <[email protected]>
@github-actions github-actions bot added the bugfix PR tag label Nov 16, 2025
@jamesarich jamesarich enabled auto-merge November 16, 2025 04:29
@codecov
Copy link

codecov bot commented Nov 16, 2025

Codecov Report

❌ Patch coverage is 0% with 35 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.56%. Comparing base (e06a598) to head (9bd4ec7).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...rg/meshtastic/core/datastore/di/DataStoreModule.kt 0.00% 33 Missing ⚠️
...lle/mesh/repository/radio/RadioInterfaceService.kt 0.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##            main   #3714      +/-   ##
========================================
- Coverage   0.56%   0.56%   -0.01%     
========================================
  Files        378     378              
  Lines      21621   21622       +1     
  Branches    2662    2662              
========================================
  Hits         122     122              
- Misses     21478   21479       +1     
  Partials      21      21              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jamesarich jamesarich added this pull request to the merge queue Nov 16, 2025
Merged via the queue into meshtastic:main with commit 9bf4b23 Nov 16, 2025
6 checks passed
@jamesarich jamesarich deleted the fix/gatt-exception branch November 16, 2025 04:40
mdecourcy pushed a commit to mdecourcy/Meshtastic-Android that referenced this pull request Nov 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix PR tag

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant