Skip to content

Commit

Permalink
Add timeout for discord_notify.py invocation (#196)
Browse files Browse the repository at this point in the history
Simple watchdog added after seeing the discord_notify.py program hang
and not return, which in its turn caused the entire container to stop
processing
  • Loading branch information
kx1t authored Jan 9, 2024
2 parents 78e59f2 + 37de8cd commit be9e48e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions rootfs/usr/share/plane-alert/plane-alert.sh
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ then
if [[ "${PA_DISCORD,,}" != "false" ]] && [[ -n "$PA_DISCORD_WEBHOOKS" ]] && [[ -n "$DISCORD_FEEDER_NAME" ]]
then
[[ "$LOGLEVEL" != "ERROR" ]] && echo "[$(date)][$APPNAME] PlaneAlert sending Discord notification" || true
python3 $PLANEALERTDIR/send-discord-alert.py "$line"
timeout 120 python3 $PLANEALERTDIR/send-discord-alert.py "$line"
fi
# Build the message field:
Expand Down Expand Up @@ -767,4 +767,4 @@ exec 3>&-

#Finally, put the temp index into its place:
mv -f "$TMPDIR"/plalert-index.tmp "$WEBDIR"/index.html
[[ "$BASETIME" != "" ]] && echo "10f. $(bc -l <<< "$(date +%s.%2N) - $BASETIME")s -- plane-alert.sh: done building webpage, finished Plane-Alert" || true
[[ "$BASETIME" != "" ]] && echo "10f. $(bc -l <<< "$(date +%s.%2N) - $BASETIME")s -- plane-alert.sh: done building webpage, finished Plane-Alert" || true
4 changes: 2 additions & 2 deletions rootfs/usr/share/planefence/planefence_notify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,8 @@ then
if [[ "${PF_DISCORD,,}" == "on" || "${PF_DISCORD,,}" == "true" ]] && [[ "x$PF_DISCORD_WEBHOOKS" != "x" ]] && [[ "x$DISCORD_FEEDER_NAME" != "x" ]]
then
LOG "Planefence sending Discord notification"
python3 "$PLANEFENCEDIR"/send-discord-alert.py "$CSVLINE" "$AIRLINE"
fi
timeout 120 python3 "$PLANEFENCEDIR"/send-discord-alert.py "$CSVLINE" "$AIRLINE"
fi

# log the message we will try to tweet or toot:
if [[ -n "$MASTODON_SERVER" ]] || [ "$TWEETON" == "yes" ]
Expand Down

0 comments on commit be9e48e

Please sign in to comment.