Closed Jack-Works closed 1 year ago
I might be wrong, but I think this is probably either:
There's not that much happening before the JS code exits on the "Cache hit occured" check.
https://github.com/actions/cache/blob/6bbe742add91b3db4abf110e742a967ec789958f/src/save.ts#L14
This is the first thing to happen when it enters the post-run code. This builds a new URL
and checks the hostname - which seems rather non-intensive.
https://github.com/actions/cache/blob/6bbe742add91b3db4abf110e742a967ec789958f/src/save.ts#L21
The next it just checks for the existence of a key in the process env. Again, non-intensive.
https://github.com/actions/cache/blob/6bbe742add91b3db4abf110e742a967ec789958f/src/save.ts#L30-L34
Next, we again just pull more info from the env (be it through a couple of function calls) then do basic statement checks.
https://github.com/actions/cache/blob/6bbe742add91b3db4abf110e742a967ec789958f/src/save.ts#L39
Finally, we get to the comparison before the exit. Which is simply just a comparison of the params using a JS internal method.
I'm running into the same issue, but the problem seems to not be related to the cache action, but rather the runner itself isn't starting the post
action in a timely fashion.
If you show timestamps you can see that the Post job cleanup
log doesn't even start for 40 s - 90 s. This string isn't printed by action/cache
but rather by the runner itself: https://github.com/actions/runner/blob/9a829995e02d2db64efb939dc2f283002595d4d9/src/Runner.Worker/Handlers/Handler.cs#L85
@malcolmstill Nice spot. That sounds about right. Is there any more info printed in the logs when you enable debug logging?
This issue is stale because it has been open for 200 days with no activity. Leave a comment to avoid closing this issue in 5 days.
ping
For some reason, to us it always take 10s when there's no cache hit but it only happens to yarn cache, our build cache sometimes take 40s
Hi 👋🏽 There is a similar issue here where the cause was identified by enabling debug logs.
If you are still seeing this issue, could you please help with the following information:
hashFiles('**/yarn.lock')
by hashFiles('yarn.lock')
and it got fixed.We have created two new actions to achieve more control on the restore and save steps. The post step takes significant time because it evaluates the inputs. To avoid the same, outputs from restore
action can be used to evaluate if you want to execute the save
action or not.
I believe this should solve the problem stated in the issue, hence closing.
I worked around this problem with this approach. It's probably more reasonable than splitting into two actions. https://github.com/ocaml/setup-ocaml/pull/724
I'm trying to optimize our build time by cache TypeScript build cache and Webpack build cache. Things work well,
TypeScript build time 1m35 => 16s, Webpack build 5m52s => 2m22s
But the total time does not short for too much, I found out the problem is the post-job cleanup of this action.
All primary keys hits and no new cache updated but it spent 2m17s~ to complete the job. I think that is very strange.
If it is the case, I expect it will complete in 5 seconds.
Here is our config:
The problematic action: https://github.com/DimensionDev/Maskbook/pull/3279/checks?check_run_id=2715205805