Update docker event query to filter events.

This commit is contained in:
Kevin Baensch 2023-01-18 10:12:23 +01:00
parent 58ce939c40
commit f1c2a7dbb3

View file

@ -38,16 +38,16 @@ update_templates() {
# Initial Generation
update_templates
# cannot filter because reailine no longer recognized lines otherwise (check how IFS changes)
query_docker "events" | while true
LAST_CHECK="$(date +%s)"
while true
do
EVENTS=""
printf '%s | Listening for docker events\n' "$(get_date)"
read -r;
# wait for related events to finish
printf '%s | Waiting for event messages to settle.\n' "$(get_date)"
while [ $? -eq 0 ]
while [ -z "${EVENTS}" ]
do
read -t 8 -r
NEXT_CHECK="$(($(date +%s) + 5))"
EVENTS=$(query_docker 'events' "?since=${LAST_CHECK}&until=${NEXT_CHECK}&filters={%22event%22:[%22die%22,%22kill%22,%22oom%22,%22pause%22,%22restart%22,%22start%22,%22stop%22,%22unpause%22,%22update%22]}")
LAST_CHECK="${NEXT_CHECK}"
done
printf '%s | Checking for changes in container label list.\n' "$(get_date)"
update_templates