Skip to content
Snippets Groups Projects
Verified Commit 92fdb49f authored by Vincent Sellier's avatar Vincent Sellier Committed by Antoine R. Dumont
Browse files

swh/counters: Avoid refresh_history cronjob infinite retries

- Use the retry command line
- Split the rpc checks from the refresh endpoint call
- Fix a couple of minor side issues

Related to swh/infra/sysadm-environment#5387
parent 9c9876a4
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@
apiVersion: batch/v1
kind: CronJob
metadata:
namespace: {{ $.Values.namespace }}
name: counters-refresh-counters-cache-cronjob
spec:
# By default, every 4h
......@@ -92,7 +93,7 @@ spec:
items:
- key: "refresh-counters-cache.sh"
path: "refresh-counters-cache.sh"
restartPolicy: OnFailure
restartPolicy: Never
{{- end -}}
{{- end -}}
......@@ -34,14 +34,13 @@ data:
}
EOF
# This waits for the rpc to be up
while true; do
sleep 1
set +e
curl -f -v -XPOST -H 'Content-Type: application/json' $host/refresh_history -d @"${tmp_file}"
[[ $? -ne 0 ]] || break
set -e
done
echo Wait 60s for the ${host} rpc service
retry -t 6 -d 10 -- curl -f -s ${host}
echo "${host} is up"
echo "Refreshing the counters history"
curl -f -v -XPOST -H 'Content-Type: application/json' $host/refresh_history -d @"${tmp_file}"
echo "Done"
fetch-static-history.sh: |
#!/bin/bash
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment