Skip to content

Do not raise an exception if external stats endpoint fails, so login can work again. More verbosity for errors.#7187

Merged
ramyaragupathy merged 2 commits intodevelopfrom
hotfix/update-stats-error
Mar 9, 2026
Merged

Do not raise an exception if external stats endpoint fails, so login can work again. More verbosity for errors.#7187
ramyaragupathy merged 2 commits intodevelopfrom
hotfix/update-stats-error

Conversation

@emi420
Copy link
Copy Markdown
Collaborator

@emi420 emi420 commented Mar 7, 2026

What type of PR is this? (check all applicable)

  • 🐛 Hot Fix

Describe this PR

Today people started to report problems with logging in. After some testing, I saw an error in the backend logs when the users stats are updated. In the production instance we can see this error:

2026-03-07 20:37:04.238 | DEBUG    | loguru._logger:debug:2040 - External-Error in OSM API

I've added more verbosity for the error logs in the function that update and save user stats and running TM locally I got HTTP error code 429 "Too many requests".

This PR adds more verbosity but also let the process continue when there's an error in an external stats API (OSM or OhSome), returning an empty object and not updating stats for the user.

Review Guide

AFAIK, returning an empty object for stats should not affect anything. Stats will be outdated until the both external stats services are working, but please take a look into this to be sure.

You can block any external stats URL manually (ex: using /etc/hosts) and see how it works when a requests fail. The error log will include more details now.

Then you can test this code in development/staging/prod to check that everything is working ok. Even if the OSM server keeps returning "Too many requests", login and other features should work, the affected features will be user stats reporting and badges + updating mapper level.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Mar 7, 2026

@ramyaragupathy
Copy link
Copy Markdown
Member

@emi420 - thanks for documenting the observations. @prabinoid - once PR is approved from your end, let's go ahead merge it so that it is not blocking contribution workflow.

We need to understand:

  • too many requests code
  • always make the stats fetch non-blocking

@prabinoid
Copy link
Copy Markdown
Collaborator

As mentioned by @emi420 , after deploying the hotfix, the login will work but the stats update and mapper level upgrades will still not work due to the 429, too many requests error. Creating a separate ticket to track this, but for the time being, hotfix can be merged so that the login would work.

@ramyaragupathy ramyaragupathy merged commit f34b34e into develop Mar 9, 2026
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants