fix(flex): defer swarm follower wait until after runtime build#663
Merged
kojiromike merged 1 commit intoopenemr:masterfrom Apr 27, 2026
Merged
fix(flex): defer swarm follower wait until after runtime build#663kojiromike merged 1 commit intoopenemr:masterfrom
kojiromike merged 1 commit intoopenemr:masterfrom
Conversation
Flex containers in SWARM_MODE=start the follower alongside the leader. The follower was blocking on the leader before cloning/building OpenEMR, so its Docker health start_period was consumed during the wait and then again during npm/composer—often exceeding the health check window and failing CI. - Introduce SWARM_WAIT_DEFERRED: followers skip wait_for_swarm_completion until after the local flex build block, then run wait + prepare_swarm_leader. - Split wait vs leader prep into wait_for_swarm_completion and prepare_swarm_leader for a clear call order. - Fix leader takeover checks: try_become_leader always returns 0, so gate promotion on AUTHORITY=yes instead of treating the return code as success. Tests: - Bats: assert_script_syntax on flex openemr.sh; smoke checks for swarm deferral. Validated with: bats tests/bats/flex/openemr.bats and ./utilities/container_benchmarking/test_functionality.sh flex --test swarm_mode
Contributor
Author
|
@kojiromike closes #661 |
kojiromike
approved these changes
Apr 27, 2026
Member
kojiromike
left a comment
There was a problem hiding this comment.
Clean refactor with a real bug fix (try_become_leader return-code gating) and a sensible deferred-wait pattern that lets flex followers parallelize their local build with the leader's shared-volume setup. CI green across the matrix. New assert_script_syntax test is a nice safety net.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Flex containers in SWARM_MODE=start the follower alongside the leader. The follower was blocking on the leader before cloning/building OpenEMR, so its Docker health start_period was consumed during the wait and then again during npm/composer—often exceeding the health check window and failing CI.
Tests:
Validated with: bats tests/bats/flex/openemr.bats and ./utilities/container_benchmarking/test_functionality.sh flex --test swarm_mode
Closes #661