Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/intentions-queue
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2023-07-17 20:55:55 +0200
committerErich Eckner <git@eckner.net>2023-07-17 20:55:55 +0200
commit5b1d7ff5b9c42bed0bcdfcb42ff2f5bb799562fc (patch)
treec0442f48bbfdd8647a38226dd824997dba8e8b2b /lib/intentions-queue
parent92aa69da7bec790286857c836884be6b7986ce4d (diff)
lib/intentions-queue: make execute_all_intentions() locking
* now, it's safe to call it in almost all places * this enables us to do it at the start of many scripts, potentially cleaning up old left-over intentions
Diffstat (limited to 'lib/intentions-queue')
-rwxr-xr-xlib/intentions-queue8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/intentions-queue b/lib/intentions-queue
index 61ec4f3..f244e1b 100755
--- a/lib/intentions-queue
+++ b/lib/intentions-queue
@@ -92,7 +92,15 @@ intentions_left() {
# execute_all_intentions
# executes all intentions
execute_all_intentions() {
+ exec 6> "${intentions_lock_file}"
+ if ! verbose_flock 6; then
+ >&2 echo 'someone already executes intentions - no need to schedule a second run'
+ return
+ fi
+
while intentions_left -n; do
execute_intention
done
+
+ flock -u 6
}