Skip to content

fix: remove temporary directories on stop and cleanup#53

Open
donbowman wants to merge 1 commit into
wey-gu:mainfrom
donbowman:fix-cleanup
Open

fix: remove temporary directories on stop and cleanup#53
donbowman wants to merge 1 commit into
wey-gu:mainfrom
donbowman:fix-cleanup

Conversation

@donbowman

Copy link
Copy Markdown

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)

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant