Skip to content

Commit

Permalink
fix github rate limit wait
Browse files Browse the repository at this point in the history
  • Loading branch information
youegraillot committed Nov 27, 2022
1 parent 0fd770c commit 18bde96
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions root/etc/services.d/setup/run
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,10 @@ plugin=$(apiCall "GET" "system/plugins" | jq '.[]|select(.name=="Deemix")')
if [ -z "$plugin" ] || [ "$(echo "$plugin" | jq .updateAvailable)" = "true" ]; then
echo "[autoconfig] Installing / Updating Deemix 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 ))
if [ "$(echo "$githubRate" | jq .remaining)" = "0" ]; then
deltaGithubResetTime=$(( $(echo "$githubRate" | jq .reset) - $(date +%s) + 5 ))
echo "[autoconfig] Waiting github rate limit reset : $deltaGithubResetTime seconds"
sleep $deltaGithubResetTime
fi
apiCall "POST" "command" '{"name":"InstallPlugin","githubUrl":"'$urlPlugin'"}'

Expand Down

0 comments on commit 18bde96

Please sign in to comment.