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 @@ ...@@ -4,6 +4,7 @@
apiVersion: batch/v1 apiVersion: batch/v1
kind: CronJob kind: CronJob
metadata: metadata:
namespace: {{ $.Values.namespace }}
name: counters-refresh-counters-cache-cronjob name: counters-refresh-counters-cache-cronjob
spec: spec:
# By default, every 4h # By default, every 4h
...@@ -92,7 +93,7 @@ spec: ...@@ -92,7 +93,7 @@ spec:
items: items:
- key: "refresh-counters-cache.sh" - key: "refresh-counters-cache.sh"
path: "refresh-counters-cache.sh" path: "refresh-counters-cache.sh"
restartPolicy: OnFailure restartPolicy: Never
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
...@@ -34,14 +34,13 @@ data: ...@@ -34,14 +34,13 @@ data:
} }
EOF EOF
# This waits for the rpc to be up echo Wait 60s for the ${host} rpc service
while true; do retry -t 6 -d 10 -- curl -f -s ${host}
sleep 1 echo "${host} is up"
set +e
curl -f -v -XPOST -H 'Content-Type: application/json' $host/refresh_history -d @"${tmp_file}" echo "Refreshing the counters history"
[[ $? -ne 0 ]] || break curl -f -v -XPOST -H 'Content-Type: application/json' $host/refresh_history -d @"${tmp_file}"
set -e echo "Done"
done
fetch-static-history.sh: | fetch-static-history.sh: |
#!/bin/bash #!/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