Skip to content

Commit

Permalink
Exit instead of continue if we didn't get "in" pipe after 60s
Browse files Browse the repository at this point in the history
Commit increases wait-on-connection time from 15 to 60 seconds.
Also, if we didn't get "in" pipe after 60 seconds, exit. Because if we
don't exit, we end up with files instead of pipes. It's possible that
wait-on-connection timeout will have to be adjusted further.
  • Loading branch information
zstyblik committed Jul 14, 2024
1 parent b5a324c commit a0a07df
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions iibot-ng
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,15 @@ time_slept=0
while ! test -p "${ircdir}/${network}/in"; do
sleep 1
time_slept=$((time_slept + 1))
if [ ${time_slept} -ge 15 ]; then
break
if [ ${time_slept} -ge 60 ]; then
# We either didn't get the connection or something went wrong -> crash.
#
# NOTE(zstyblik): we cannot continue without pipe. If we do, then it
# looks like we will end up with files instead of pipes(which is bad).
# This doesn't mean that pipe cannot go away later, but still.
printf "Pipe '%s' still does not exist - giving up.\n" \
"${ircdir}/${network}/in" 1>&2
exit 1
fi
done

Expand Down

0 comments on commit a0a07df

Please sign in to comment.