Skip to content

Enable per-device concurrent sync event processing#3881

Merged
guiyanakuang merged 1 commit intomainfrom
fix/issue-3880-per-device-concurrent-events
Feb 15, 2026
Merged

Enable per-device concurrent sync event processing#3881
guiyanakuang merged 1 commit intomainfrom
fix/issue-3880-per-device-concurrent-events

Conversation

@guiyanakuang
Copy link
Copy Markdown
Member

Summary

  • Replace MutableSharedFlow with Channel(UNLIMITED) + launch per event in GeneralSyncManager, enabling concurrent event processing across different devices
  • Add per-device Mutex in SyncResolver to serialize events for the same appInstanceId while allowing events for different devices to process concurrently
  • appInstanceId() helper extracts the device identifier from all event types for mutex routing

Fixes #3880

Changes

  • GeneralSyncManager.kt: MutableSharedFlowChannel(UNLIMITED), collectfor + launch
  • SyncResolver.kt: Add deviceMutexes map with Mutex lock guard, extract processEvent(), wrap with per-device mutex.withLock

Test plan

  • All 941 existing tests pass
  • Manual test: connect 2+ devices, verify concurrent connection resolution
  • Verify slow/unreachable device doesn't block other devices

Replace MutableSharedFlow with Channel + launch in GeneralSyncManager
to allow concurrent event processing across different devices. Add
per-device Mutex in SyncResolver to serialize events for the same
appInstanceId while allowing different devices to process concurrently.

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
@guiyanakuang guiyanakuang force-pushed the fix/issue-3880-per-device-concurrent-events branch from dca57e9 to 290689f Compare February 15, 2026 14:29
@guiyanakuang guiyanakuang merged commit fac72c2 into main Feb 15, 2026
2 checks passed
@guiyanakuang guiyanakuang deleted the fix/issue-3880-per-device-concurrent-events branch February 15, 2026 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Sync events for all devices are serialized, blocking concurrent connections

1 participant