fix: remove temporary directories on stop and cleanup#53
Open
donbowman wants to merge 1 commit into
Open
Conversation
Clean up both the socket directory and the auto-created work directory when the PGlite manager stops. Previously only the socket file was removed, leaving empty parent directories and work directories in /tmp that accumulated over time. - Add `_cleanup_temp_dirs()` to PGliteManager that removes the socket parent directory and the auto-generated work directory (via rmtree) - Track `_auto_work_dir` flag so user-specified work dirs are preserved - Ensure socket directory is recreated on `start()` so restart after stop works correctly - Call `_cleanup_temp_dirs()` from all three manager stop() methods: PGliteManager, SQLAlchemyPGliteManager, SQLAlchemyAsyncPGliteManager - Add 9 tests in TestTempDirCleanup covering edge cases (non-empty dirs, already-deleted dirs, cleanup_on_exit gating, OS-level process termination verification, and end-to-end start/stop cycles)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Clean up both the socket directory and the auto-created work directory when the PGlite manager stops. Previously only the socket file was removed, leaving empty parent directories and work directories in /tmp that accumulated over time.
_cleanup_temp_dirs()to PGliteManager that removes the socket parent directory and the auto-generated work directory (via rmtree)_auto_work_dirflag so user-specified work dirs are preservedstart()so restart after stop works correctly_cleanup_temp_dirs()from all three manager stop() methods: PGliteManager, SQLAlchemyPGliteManager, SQLAlchemyAsyncPGliteManager