]> xenbits.xensource.com Git - people/iwj/osstest.git/commitdiff
mg-clear-git-caches: make parallel
authorIan Jackson <iwj@woking.cam.xci-test.com>
Mon, 1 Jul 2013 15:40:02 +0000 (16:40 +0100)
committerIan Jackson <iwj@woking.cam.xci-test.com>
Mon, 1 Jul 2013 15:40:02 +0000 (16:40 +0100)
mg-clear-git-caches

index 5cab72714aef51047a069cb0a9d357599963871c..76b5f513de54791bd612cbee22fc99798b687809 100755 (executable)
@@ -28,16 +28,23 @@ cache=`getconfig GitCacheLocal`
 for lockfile in $cache/*/lock; do
        hostdir=${lockfile%/lock}
        host=${hostdir##*/}
-       printf "===== %s =====\n" $host
-       aside=$cache/$host.$$.`date +%s`.to-delete
-       mkdir $aside
-       if ! ./mg-allocate -U 10 $host; then continue; fi
-       set +e
-       mv $hostdir $aside/.
-       r=$?
-       set -e
-       ./mg-allocate !$host
-       if [ $r != 0 ]; then echo >&2 ' failed'; exit $r; fi
-       printf ' deleting\n'
-       sudo rm -rf $aside
+       (
+               printf "===== %s =====\n" $host
+               aside=$cache/$host.$$.`date +%s`.to-delete
+               mkdir $aside
+               if ! ./mg-allocate -U 10 $host; then continue; fi
+               set +e
+               mv $hostdir $aside/.
+               r=$?
+               set -e
+               ./mg-allocate !$host
+               if [ $r != 0 ]; then echo >&2 ' failed'; exit $r; fi
+               printf ' deleting\n'
+               sudo rm -rf $aside
+       ) &
+       sleep 0.5
 done
+
+echo "===== (waiting) ====="
+
+wait