-
Notifications
You must be signed in to change notification settings - Fork 364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
State restoration fails if a repo has many caches #1136
Comments
Hello @anomiex |
I notice there is a linked pr #1152 is there any possibility this might move forward? |
We're seeing this, too. A fix would be highly appreciated. Handler might end up in
otherwise. |
As a workaround I'm using the action in the linked PR and it works well.
|
Description:
If a repository has many caches being used between runs of
actions/stale
, such that the "_state" cache entry is not on the first page of results returned from the list caches API,actions/stale
will fail to restore its state and then will fail to update the state.Action version:
9.0.0
Platform:
Runner type:
Repro steps:
actions/stale
with a lowoperations-per-run
and enough issues that a single run cannot process them all.actions/stale
run, which should create the "_state" cache entry.https://api.github.com/repos/{owner}/{repo}/actions/caches
no longer includes "_state" as it has been pushed to the second page of results.actions/stale
run again.My test repo for this issue is at https://github.com/anomiex/test-stale.
Expected behavior:
For step 4, the state is restored correctly and processing continues from where the previous run left off.
Actual behavior:
In step 4, near the start, it reports
Processing begins from the first issue. Then at the end it reports
Analysis:
The
checkIfCacheExists
function only checks the first page of results, using the default value of 30 entries per page.stale/src/classes/state/state-cache-storage.ts
Lines 33 to 46 in 3f3b017
While you could fix the bug by adding pagination so the relevant cache entry is found even if it's not on the first page, a more performant fix would be to make use of the
key
andref
parameters to the list caches API to specify the branch and key that we actually care about.I suppose doing both would be an even better idea, just in case some repo is creating a lot of other cache entries with the "_state" prefix.
The text was updated successfully, but these errors were encountered: