Skip to content

fix: wiping metrics on metric-api failures#3846

Merged
ThibaudDauce merged 1 commit into
mainfrom
fix_wiping_metrics_on_api_metric_failure
Jun 25, 2026
Merged

fix: wiping metrics on metric-api failures#3846
ThibaudDauce merged 1 commit into
mainfrom
fix_wiping_metrics_on_api_metric_failure

Conversation

@ThibaudDauce

Copy link
Copy Markdown
Contributor

@maudetes maudetes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean!

Comment thread udata/core/site/models.py
Comment on lines +105 to +106
visits = get_metrics_for_model("site", None, ["visit_dataset"])
if visits is not None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use a walrus operator?

Suggested change
visits = get_metrics_for_model("site", None, ["visit_dataset"])
if visits is not None:
if visits := get_metrics_for_model("site", None, ["visit_dataset"]):

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'll match an empty array in the response, not sure it's what we want since we explicitly return None to say "keep the old value", other falsy value may not have the same meaning (even if it's not possible right now)

@ThibaudDauce
ThibaudDauce merged commit eb49b7c into main Jun 25, 2026
1 check passed
@ThibaudDauce
ThibaudDauce deleted the fix_wiping_metrics_on_api_metric_failure branch June 25, 2026 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Manque de certains indicateurs sur la page dashboard du site

2 participants