mill
mill copied to clipboard
Cleanup Mill sandbox dir asynchronously
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.
- Each process takes a lock on the sandbox,
- Every subsequent process lists the existing sandboxes and probe the lock
- 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