mill icon indicating copy to clipboard operation
mill copied to clipboard

Cleanup Mill sandbox dir asynchronously

Open lefou opened this issue 1 year ago • 0 comments

When Mill is started with --no-server option, it creates a new sandbox dir for each run.

How about we clean up asynchronously? e.g.

  1. Each process takes a lock on the sandbox,
  2. Every subsequent process lists the existing sandboxes and probe the lock
  3. If the lock is available, it means the process has exited, and we can delete the folder

That way for the common workflow of running Mill from the command line, we don't delete stuff immediately, but only upon the next command.

Probably something similar can be done for the long lived mill-worker-* folders as well: if the folder exists but both the clientLock and processLock are available, it means the process has exited and can be cleaned up

Originally posted by @lihaoyi in https://github.com/com-lihaoyi/mill/issues/3396#issuecomment-2297366548

lefou avatar Aug 20 '24 06:08 lefou