Skip to content

MS-1350 Worker scheduling simplification#1595

Merged
luhmirin-s merged 3 commits intomainfrom
feature/MS-1350-worker-schedule-fixes
Feb 17, 2026
Merged

MS-1350 Worker scheduling simplification#1595
luhmirin-s merged 3 commits intomainfrom
feature/MS-1350-worker-schedule-fixes

Conversation

@luhmirin-s
Copy link
Contributor

JIRA ticket
Will be released in: 2026.2.0

Root cause analysis (for bugfixes only)

First known affected version: 2026.2.0

  • On application start all background workers were fully cancelled and rescheduled with "initialDelay=0", which caused sync execution on start.

Notable changes

  • Removed the explicit worker cancellation during reschedule. We can rely on the existing working policy to avoid duplicate workers.
  • Changed the initial delay to only be set if explicitly provided.
  • Removed the rescheduleAfter variation of the command as it is now only used in test and it would be better to cancel and reschedule the workers explicitly.

Testing guidance

  • Log into SID in a project with sync frequency set to "PERIODICALLY".
  • Do a biometric flow.
  • Kill the SID process.
  • Open SID while tracking logs - there should be no workers starting when SID process is created.

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)

Copy link

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

Simplifies sync worker scheduling to prevent sync running immediately on app start by reducing explicit cancellations and making initial delay optional when scheduling periodic work via WorkManager.

Changes:

  • Removed rescheduleAfter commands and the “blockWhileUnscheduled” mechanism from scheduling commands/orchestrator execution.
  • Updated periodic worker scheduling wrapper to only apply setInitialDelay(...) when explicitly requested.
  • Updated/removed unit tests to align with the new scheduling command API.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
infra/sync/src/main/java/com/simprints/infra/sync/extensions/WorkManager.ext.kt Makes periodic worker initial delay optional (sentinel-based) when building PeriodicWorkRequests.
infra/sync/src/main/java/com/simprints/infra/sync/SyncOrchestratorImpl.kt Removes “cancel + block + reschedule” behavior from RESCHEDULE execution path.
infra/sync/src/main/java/com/simprints/infra/sync/ScheduleSyncCommand.kt Removes rescheduleAfter variants and related command fields.
infra/sync/src/main/java/com/simprints/infra/sync/config/usecase/ResetLocalRecordsIfConfigChangedUseCase.kt Switches from rescheduleAfter { ... } to explicit UNSCHEDULE → reset → RESCHEDULE flow.
infra/sync/src/test/java/com/simprints/infra/sync/config/usecase/ResetLocalRecordsIfConfigChangedUseCaseTest.kt Updates assertions to expect explicit UNSCHEDULE + RESCHEDULE calls.
infra/sync/src/test/java/com/simprints/infra/sync/SyncOrchestratorCommandExecutionTest.kt Removes tests targeting the deleted rescheduleAfter behavior.
infra/sync/src/test/java/com/simprints/infra/sync/ScheduleSyncCommandTest.kt Removes tests covering the deleted rescheduleAfter command builders.

@luhmirin-s luhmirin-s requested review from a team, BurningAXE, TristramN, alex-vt, alexandr-simprints, meladRaouf and ybourgery and removed request for a team February 17, 2026 13:30
@sonarqubecloud
Copy link

@luhmirin-s luhmirin-s merged commit d2aad4b into main Feb 17, 2026
20 checks passed
@luhmirin-s luhmirin-s deleted the feature/MS-1350-worker-schedule-fixes branch February 17, 2026 14:57
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.

5 participants