tasks & workers: use NULL in reads from db

This commit is contained in:
Vincent Riquer 2025-11-10 15:36:26 +01:00
parent c5815669e2
commit 0cf8ee09b4
3 changed files with 6 additions and 6 deletions

View File

@ -10,7 +10,7 @@ gettaskinfos() {
FROM tasks
WHERE id='$1';
' >&3
read -u4 line
read -u4 -d$'\0' line
taskid=${line%%::AtOM:SQL:Sep::*}
rest="${line#*::AtOM:SQL:Sep::}::AtOM:SQL:Sep::"
sourcefileid=${rest%%::AtOM:SQL:Sep::*}

View File

@ -2,7 +2,7 @@
createworker() {
(( ++active ))
read -u4 line
read -u4 -d$'\0' line
taskid=${line%%::AtOM:SQL:Sep::*}
rest="${line#*::AtOM:SQL:Sep::}::AtOM:SQL:Sep::"
sourcefileid=${rest%%::AtOM:SQL:Sep::*}

View File

@ -10,7 +10,7 @@ master() {
WHERE status = 0;
'>&3
read -u4 remaining
read -u4 -d$'\0' remaining
if (( remaining == 0 ))
then
sleep 0.1
@ -108,7 +108,7 @@ master() {
LIMIT 1;
'>&3
read -u4 ready
read -u4 -d$'\0' ready
if (( ready > 0 ))
then
createworker
@ -194,7 +194,7 @@ master() {
LIMIT 1;
' >&3
read -u4 ready
read -u4 -d$'\0' ready
if (( active == 0 && ready == 0 ))
then
@ -234,7 +234,7 @@ master() {
WHERE status = 0;
'>&3
read -u4 remaining
read -u4 -d$'\0' remaining
done
fi
}