Skip to content

Commit

Permalink
πŸ› Delete only root folder in cache on instance delete (#864)
Browse files Browse the repository at this point in the history
delete only root folder in cache on instance delete
  • Loading branch information
Koncopd authored Sep 23, 2024
1 parent fa23386 commit 5017be3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lamindb_setup/_delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
from .core._settings_instance import InstanceSettings


def delete_cache(cache_dir: Path):
if cache_dir is not None and cache_dir.exists():
def delete_cache(isettings: InstanceSettings):
# avoid init of root
cache_dir = isettings.storage.cache_dir / isettings.storage._root_init
if cache_dir.exists():
shutil.rmtree(cache_dir)


Expand All @@ -35,7 +37,7 @@ def delete_by_isettings(isettings: InstanceSettings) -> None:
settings_file = isettings._get_settings_file()
if settings_file.exists():
settings_file.unlink()
delete_cache(isettings.storage.cache_dir)
delete_cache(isettings)
if isettings.dialect == "sqlite":
try:
if isettings._sqlite_file.exists():
Expand Down

0 comments on commit 5017be3

Please sign in to comment.