atom: commit every 60 seconds when transcoding

This commit is contained in:
Vincent Riquer 2025-01-23 00:23:14 +01:00
parent 8b4c7e51ce
commit 33120e8be3

8
atom
View File

@ -697,8 +697,15 @@ starttime=$concurrencychange
taskcount=$count taskcount=$count
remaining=$taskcount remaining=$taskcount
failed=0 failed=0
echo 'BEGIN TRANSACTION;' >&3
committime=$(date +%s)
while (( (remaining || ${#workers[@]}) && ! quit )) while (( (remaining || ${#workers[@]}) && ! quit ))
do do
if (( $(date +%s) - committime >= 60 ))
then
echo $'COMMIT;\nBEGIN TRANSACTION;' >&3
committime=$(date +%s)
fi
read humanload garbage < /proc/loadavg read humanload garbage < /proc/loadavg
load=${humanload%.*} load=${humanload%.*}
if (( fixed_workers )) if (( fixed_workers ))
@ -799,6 +806,7 @@ do
fi fi
fi fi
done done
echo 'COMMIT;' >&3
unset count unset count
endtime=$(date +%s) endtime=$(date +%s)