Skip to content

Don't require connection for event sync if CommCare downsync source is configured#1371

Merged
BurningAXE merged 1 commit into
release/2025.3.0from
bugfix/event-sync-requires-connection-regardless-of-source
Sep 23, 2025
Merged

Don't require connection for event sync if CommCare downsync source is configured#1371
BurningAXE merged 1 commit into
release/2025.3.0from
bugfix/event-sync-requires-connection-regardless-of-source

Conversation

@BurningAXE
Copy link
Copy Markdown
Contributor

@BurningAXE BurningAXE commented Sep 22, 2025

JIRA ticket
Will be released in: 2025.3.0

Root cause analysis (for bugfixes only)

First known affected version: 2025.3.0-dev

  • In WorkManager.ext we have defaultWorkerConstraints that set NetworkType.CONNECTED
  • Unless explicitly specified, these default constraints apply to all periodic and one-time worker requests
  • So far connection has indeed been required by all workers
  • With the introduction of CommCare downsync source that's no longer the case as syncing happens locally on the device
  • CommCareEventSyncDownloaderWorker is indeed built with no network connection constraint
  • However, EventSyncMasterWorker requires connection so it never runs to build CommCareEventSyncDownloaderWorker

Notable changes

  • When scheduling event sync in SyncOrchestratorImpl (either periodic or one time) we check if CommCare downsync source is configured and set connection constraints accordingly

Testing guidance

Additional work checklist

  • Effect on other features and security has been considered
  • Design document marked as "In development" (if applicable)
  • External (Gitbook) and internal (Confluence) Documentation is up to date (or ticket created)
  • Test cases in Testiny are up to date (or ticket created)
  • Other teams notified about the changes (if applicable)

@cla-bot cla-bot Bot added the ... label Sep 22, 2025
@BurningAXE BurningAXE requested a review from Copilot September 22, 2025 16:38
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes an issue where the EventSyncMasterWorker was preventing CommCare downsync from functioning due to unnecessary network connection requirements.

Key changes:

  • Modified event sync scheduling to conditionally set network constraints based on whether CommCare downsync is configured
  • Made event sync methods suspend functions to allow async configuration retrieval
  • Updated debug UI to handle the new suspend function calls

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
SyncOrchestratorImpl.kt Added dynamic network constraint logic and made event sync methods suspend
SyncOrchestrator.kt Updated interface to make event sync methods suspend functions
DebugFragment.kt Added coroutine scope launches to handle suspend function calls

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@BurningAXE BurningAXE force-pushed the bugfix/event-sync-requires-connection-regardless-of-source branch from 6776c48 to fab3f77 Compare September 22, 2025 17:00
@sonarqubecloud
Copy link
Copy Markdown

@BurningAXE BurningAXE marked this pull request as ready for review September 22, 2025 17:17
@BurningAXE BurningAXE requested review from a team, TristramN, alex-vt, alexandr-simprints, luhmirin-s, meladRaouf and ybourgery and removed request for a team September 22, 2025 17:19
@BurningAXE BurningAXE merged commit a1d2a58 into release/2025.3.0 Sep 23, 2025
13 checks passed
@luhmirin-s luhmirin-s deleted the bugfix/event-sync-requires-connection-regardless-of-source branch September 24, 2025 07:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants