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
@@ -756,3 +756,23 @@ uninstall_k3s() {
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
}
|
||||
|
||||
run_concurrently() {
|
||||
declare desc="runs a command COUNT times in parallel, appending the run number as the last argument, and fails if any run fails"
|
||||
declare COUNT="$1"
|
||||
shift 1
|
||||
local i pid failed=0
|
||||
local pids=()
|
||||
|
||||
for i in $(seq 1 "$COUNT"); do
|
||||
"$@" "$i" &
|
||||
pids+=("$!")
|
||||
done
|
||||
|
||||
for pid in "${pids[@]}"; do
|
||||
wait "$pid" || failed=$((failed + 1))
|
||||
done
|
||||
|
||||
echo "failed runs: $failed"
|
||||
[[ "$failed" -eq 0 ]]
|
||||
}
|
||||
Reference in new issue
Block a user