cache-nix-action icon indicating copy to clipboard operation
cache-nix-action copied to clipboard

[BUG] Garbage collection doesn't work

Open minijackson opened this issue 8 months ago • 1 comments

Describe the bug

I set gc-max-store-size: 2147483648 in my workflow, but it doesn't seem to run the garbage collector, despite the store being bigger than 2GiB.

To Reproduce

See this run: https://github.com/epics-extensions/EPNix/actions/runs/13545273839/job/37855267351

Where the store size is 4966651976, and the max store size is 2147483648, but the garbage collector isn't run.

Expected behavior

The garbage collector is run.

Additional context

I suspect it has to do with this file: https://github.com/nix-community/cache-nix-action/blob/f3b2117088fb18d8f68732afa26453ee53d7c5cd/src/utils/collectGarbage.ts

And the fact that setting the STORE_SIZE and using it is done in two separate Bash processes. I think in the second bash process, in (( STORE_SIZE > MAX_STORE_SIZE )), STORE_SIZE is undefined, and so the condition always returns false.

minijackson avatar Feb 26 '25 14:02 minijackson