extender icon indicating copy to clipboard operation
extender copied to clipboard

Clean up Cocoapod cache after each build

Open britzl opened this issue 1 year ago • 3 comments
trafficstars

The pod cache can grow quickly if the server gets a lot of build requests for a variety of extensions. Having a cronjob will not guarantee that we don't run out of disk. I propose that the CocoapodService.java will prune or wipe the cache after every build.

britzl avatar Feb 06 '24 13:02 britzl

Several ideas:

  1. Schedule job in CocoapodsService to clean cache via command
pod cache clean --all

During cleanup all build request waits while operation is ended. 2. Cleanup pod used during the build

pod cache clean <name>

Can be problem when pod used in other build that currently running.

Personally I'd like variant 1.

Another suggestion. Make cocoapods repo update also as scheduled job that runs every hour (for example). And remove --repo-update flag from pod install command. It helps avoid errors when pod tries update repo in concurrent manner. As drawback - if user wants to user the "freshest" version of dependency - job can fail because version won't be in cache yet. I think in our case it's an acceptable drawback because user uses dependencies with pinned version and check is new version build or not before going production.

ekharkunov avatar Oct 16 '24 07:10 ekharkunov

Personally I'd like variant 1.

I agree. This is probably the best way.

Make cocoapods repo update also as scheduled job that runs every hour (for example). And remove --repo-update flag from pod install command

Nice idea!

britzl avatar Oct 16 '24 08:10 britzl

Maybe as the future step: it would be nice if Cron job check size (bigger or not of some limit we set) and clean only if condition met

AGulev avatar Oct 16 '24 10:10 AGulev