Skip to content

Commit

Permalink
fixup pre-stop-hook bug: account for multiple allocation metrics (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
jschaul authored Feb 5, 2024
1 parent 6d2a508 commit e196a14
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion docker/coturn/wireapp/pre-stop-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,16 @@ while true; do
echo "No more active allocations, exiting"
exit 0
fi
if [ "$allocs" = 0 ]; then

# Note: there can be multiple allocation counts, e.g.
# turn_total_allocations{type="UDP"} 0
# turn_total_allocations{type="TCP"} 0
# So we need to sum the counts before comparing with 0.
sum=0
for num in $allocs; do
(( sum += num ))
done
if [ "$sum" = 0 ]; then
echo "No more active allocations, exiting"
exit 0
fi
Expand Down

0 comments on commit e196a14

Please sign in to comment.