Skip to content

Commit 2eac3f3

Browse files
authored
Fix crawler endpoint bis (#302)
1 parent 1d7365f commit 2eac3f3

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

CHANGELOG.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
- Fill in check throughout the process to send previous steps infos in case of late crash [#293](https://github.com/datagouv/hydra/pull/293)
88
- Fix purge csv tables CLI by using the csv db connection [#294](https://github.com/datagouv/hydra/pull/294)
99
- Better gz files extraction function name [#295](https://github.com/datagouv/hydra/pull/295)
10-
- Add more detailed statuses [#297](https://github.com/datagouv/hydra/pull/297)
11-
- Handle cases of too long columns labels for postgres [#298](https://github.com/datagouv/hydra/pull/298)
12-
- Fix rare issue in `/status/crawler/` endpoint [#299](https://github.com/datagouv/hydra/pull/299)
10+
- Add more detailed statuses [#298](https://github.com/datagouv/hydra/pull/298)
11+
- Handle cases of too long columns labels for postgres [#299](https://github.com/datagouv/hydra/pull/299)
12+
- Fix rare issue in `/status/crawler/` endpoint [#301](https://github.com/datagouv/hydra/pull/301) [#302](https://github.com/datagouv/hydra/pull/302)
1313

1414
## 2.3.0 (2025-07-15)
1515

udata_hydra/routes/status.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,11 @@ async def get_crawler_status(request: web.Request) -> web.Response:
3636
# all w/ a check, minus those with an outdated checked
3737
count_fresh_checks: int = stats_resources["count_checked"] - stats_checks["count_outdated"]
3838
total: int = stats_resources["count_never_checked"] + stats_resources["count_checked"]
39-
rate_checked: float = round(stats_resources["count_checked"] / total * 100, 1)
40-
rate_checked_fresh: float = round(count_fresh_checks / total * 100, 1)
39+
if total > 0:
40+
rate_checked: float = round(stats_resources["count_checked"] / total * 100, 1)
41+
rate_checked_fresh: float = round(count_fresh_checks / total * 100, 1)
42+
else:
43+
rate_checked, rate_checked_fresh = None, None
4144

4245
async def get_resources_status_counts(request: web.Request) -> dict[str | None, int]:
4346
status_counts: dict = {status: 0 for status in Resource.STATUSES}

0 commit comments

Comments
 (0)