Closed aisamu closed 1 year ago
THisis only a per repo memory cache, so renovate should continue on next run without any issues. so temporary registry issues shouldn't be a problem
Oh, I see! Would retries on the same repo clear the cache?
not on current run. it will be cleared after each repo.
It's possible that values are saved to the package cache
It's possible that values are saved to the package cache
i don't think we cache there on error
What would you like Renovate to be able to do?
HTTP requests have an opt-out caching behavior for all GET and HEAD requests. It appears that errors are also being cached (e.g. when the request ends up failing/throwing), preventing retries to go through down the line.
If you have any ideas on how this should be implemented, please tell us here.
Full context: https://github.com/renovatebot/renovate/pull/17761 The above PR evicts the cache entry for a given request when the request ends up failing/throwing, allowing a retry to go through down the line (e.g. on another renovate run).
The following is a delineation of the reasoning leading us there. The goal of the verbosity is to make incorrect assumptions as explicit as possible:
Error message from Renovate logs:
Single occurrence of that error string on the codebase: https://github.com/aisamu/renovate/blob/ef17f8a11103a42ee72b4a819a68204712280c76/lib/modules/datasource/npm/get.ts#L181
First line of the containing try-catch block making an HTTP call (as the error message contains a status code) https://github.com/aisamu/renovate/blob/ef17f8a11103a42ee72b4a819a68204712280c76/lib/modules/datasource/npm/get.ts#L67
getJson
defers torequestJson
, which defers torequest
: https://github.com/aisamu/renovate/blob/ef17f8a11103a42ee72b4a819a68204712280c76/lib/util/http/index.ts#L212-L232request
reads allget
andhead
requests from the cache unless opted out: https://github.com/aisamu/renovate/blob/ef17f8a11103a42ee72b4a819a68204712280c76/lib/util/http/index.ts#L147-L153We didn't find
useCache
being set/overridden on the npm datasource: https://github.com/aisamu/renovate/tree/ef17f8a11103a42ee72b4a819a68204712280c76/lib/modules/datasource/npm/get.tsrequest
caches allget
andhead
promises: https://github.com/aisamu/renovate/blob/ef17f8a11103a42ee72b4a819a68204712280c76/lib/util/http/index.ts#L147-L153request
uses the cached promise if it's non-falsy: https://github.com/aisamu/renovate/blob/ef17f8a11103a42ee72b4a819a68204712280c76/lib/util/http/index.ts#L156A rejected promise is non-falsy on node:
500 requests are
thrown
by the http abstraction: https://github.com/aisamu/renovate/blob/ef17f8a11103a42ee72b4a819a68204712280c76/lib/util/http/index.spec.ts#L58-L59The combination of the above would reasonably explain the issue observed on the PR (i.e. never-ending 504s caused by caching a failed response).
Is this a feature you are interested in implementing yourself?
Yes