handle github rate limiting

This commit is contained in:
Youe Graillot 2022-11-25 20:28:24 +01:00
parent 1804c3c3aa
commit de86ac216b
1 changed files with 5 additions and 0 deletions

View File

@ -52,6 +52,11 @@ if [ "$AUTOCONFIG" = "true" ]; then
if ! isPresent $urlPlugin "system/plugins"; then if ! isPresent $urlPlugin "system/plugins"; then
echo "[autoconfig] Installing plugin" echo "[autoconfig] Installing plugin"
githubRate=$(curl -s https://api.github.com/rate_limit | jq .rate)
if [ "$(echo "$githubRate" | jq .remaining)" = "60" ]; then
echo "[autoconfig] Waiting github rate limit reset"
sleep $(( $(echo "$githubRate" | jq .reset) - $(date +%s) + 5 ))
fi
apiCall "POST" "command" '{"name":"InstallPlugin","githubUrl":"'$urlPlugin'"}' apiCall "POST" "command" '{"name":"InstallPlugin","githubUrl":"'$urlPlugin'"}'
fi fi
if ! isPresent "path" "rootFolder"; then if ! isPresent "path" "rootFolder"; then