about summary refs log tree commit diff
path: root/tq.1
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2021-02-27 20:20:55 +0100
committerLeah Neukirchen <leah@vuxu.org>2021-03-13 16:27:55 +0100
commit9942e645b33c7d8772f7419e4b3fc8f50aa7eda8 (patch)
tree7414645645c9e5d0a7786aa137ebdaaf6ae53ca5 /tq.1
parent6c81764641c7fe4c6ac190a12b9308f4de54cb4e (diff)
downloadnq-9942e645b33c7d8772f7419e4b3fc8f50aa7eda8.tar.gz
nq-9942e645b33c7d8772f7419e4b3fc8f50aa7eda8.tar.xz
nq-9942e645b33c7d8772f7419e4b3fc8f50aa7eda8.zip
nq: revamp waiting loop to avoid busy loops in contested cases
As reported in #37, the current rewind-loop has the issue of waiting
for a lock on the first file that is locked, but it could be detected
as being locked by another process that also just wants to check this
file.  As both processes rewind the dir and retry in this case, this
can yield a busy loop.

Instead, find the newest locked file and wait for that.  This should
result in most nq processes waiting for different locks, so this kind
of synchonization cannot appear.

In theory, removing the rewinddir would be enough, as later nq runs
should not result in enqueuing earlier jobs, but it's better to be
safe and check there are no more locked files before we launch
our job.
Diffstat (limited to 'tq.1')
0 files changed, 0 insertions, 0 deletions