Skip to content

fix: when EJR tokens are invalid a refresh should be attempted - #526

Open
pvbouwel wants to merge 2 commits into
Open-EO:masterfrom
pvbouwel:fix_cache_invalidation
Open

fix: when EJR tokens are invalid a refresh should be attempted#526
pvbouwel wants to merge 2 commits into
Open-EO:masterfrom
pvbouwel:fix_cache_invalidation

Conversation

@pvbouwel

Copy link
Copy Markdown
Contributor

No description provided.

@pvbouwel
pvbouwel requested a review from soxofaan August 13, 2026 14:47
Comment thread openeo_driver/jobregistry.py Outdated
self._log.exception(f"Failed to do EJR API request `{method} {url}`: {e!r}")
raise EjrApiError(f"Failed to do EJR API request `{method} {url}`") from e
self._log.debug(f"EJR response on `{method} {path}`: {response.status_code!r}")
if response.status_code == 401 and use_auth:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this must go under the try body above, right?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Makes me also wonder about the need for that reretry.retry_call stuff, instead of the http retry utilities we're more used to

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.

Why do you think it goes there? Exceptions are for scenarios that are not handled as part of HTTP responses spec (e.g. connection issues like connection resets, are client side timeout triggering). In this case the server replies with a 401 status code so a valid HTTP response. So it is further client-side handling that should determine what to do with this response.

I was trying to make a minimal change. If you prefer to have retry.retry_call refactored out that is fine by me but I would create a separate issue for that. Because for a change like that I would think it be good if the scope is:

  • Add an AGENTS.md file stating the preferred way of making http calls
  • Have code refactor

Then future agent reviews would also help to streamline usage

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.

Ah or you mean to have handling of exceptions of the extra do_request for that it would actually make sense, digesting further :)

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.

OK, moved it because it could help avoid confusion if the request after clearing cache does get one of those connection type of issues. I guess that is a very rare case but Murphy is always around the corner and in this case either placement has similar complexity so I don't see any negative implications.

@pvbouwel
pvbouwel requested a review from soxofaan August 14, 2026 08:45
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.

2 participants