Skip to content

Commit 2c9504e

Browse files
authored
Merge pull request #7 from linuxserver/fix-scarf
Prevent scarf from failing the API health
2 parents 4f2a0e1 + a005e21 commit 2c9504e

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

root/app/updater.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -224,14 +224,18 @@ def update_images():
224224

225225
def get_monthly_pulls():
226226
pulls_map = {}
227-
response = requests.get("https://api.scarf.sh/v2/packages/linuxserver-ci/overview?per_page=1000", headers={"Authorization": f"Bearer {SCARF_TOKEN}"})
228-
results = response.json()["results"]
229-
for result in results:
230-
name = result["package"]["name"].replace("linuxserver/", "")
231-
if "total_installs" not in result:
232-
continue
233-
monthly_pulls = result["total_installs"]
234-
pulls_map[name] = monthly_pulls
227+
try:
228+
response = requests.get("https://api.scarf.sh/v2/packages/linuxserver-ci/overview?per_page=1000", headers={"Authorization": f"Bearer {SCARF_TOKEN}"})
229+
results = response.json()["results"]
230+
for result in results:
231+
name = result["package"]["name"].replace("linuxserver/", "")
232+
if "total_installs" not in result:
233+
continue
234+
monthly_pulls = result["total_installs"]
235+
pulls_map[name] = monthly_pulls
236+
except Exception as ex:
237+
print(ex)
238+
print(traceback.format_exc())
235239
return pulls_map
236240

237241
def update_scarf():
@@ -264,7 +268,8 @@ def main():
264268
gh.print_rate_limit()
265269
update_status("Success")
266270
time.sleep(INVALIDATE_HOURS*60*60)
267-
except:
271+
except Exception as ex:
272+
print(ex)
268273
print(traceback.format_exc())
269274
update_status("Failed")
270275
time.sleep(INVALIDATE_HOURS*60*60)

0 commit comments

Comments
 (0)