fix: serialize concurrent property updates
Concurrent commands for the same app could each read a setting, change it, and write it back, so all of them exited successfully while silently dropping changes made by the others. Updates to app settings are now serialized so every change is kept, and readers never see a partially written value.
This commit is contained in:
42 files changed
+1698
-642
No files matched your search
+12
-1
@@ -175,11 +175,22 @@ fn-git-build-with-lock-held() {
|
||||
|
||||
(git_build "$APP" "$REV") || exit_code="$?"
|
||||
if [[ "$exit_code" -ne 0 ]] && [[ "$has_source_image" == "true" ]]; then
|
||||
fn-plugin-property-write "git" "$APP" "source-image" "$previous_source_image"
|
||||
fn-plugin-property-lock "git" "$APP" fn-git-restore-source-image "$APP" "$source_image" "$previous_source_image"
|
||||
fi
|
||||
return "$exit_code"
|
||||
}
|
||||
|
||||
fn-git-restore-source-image() {
|
||||
declare desc="restores the previous source-image unless it was changed since the failed build set it, expecting the caller to hold the git property lock"
|
||||
declare APP="$1" BUILD_SOURCE_IMAGE="$2" PREVIOUS_SOURCE_IMAGE="$3"
|
||||
|
||||
if [[ "$(fn-git-source-image "$APP")" != "$BUILD_SOURCE_IMAGE" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
fn-plugin-property-write "git" "$APP" "source-image" "$PREVIOUS_SOURCE_IMAGE"
|
||||
}
|
||||
|
||||
cmd-git-upload-pack() {
|
||||
declare desc="executes git-upload-pack"
|
||||
declare cmd="git-upload-pack"
|
||||
|
||||
Reference in new issue
Block a user