Skip to content

Commit 931f548

Browse files
committed
Make sure we do not remove full gpkg when diff is missing
1 parent 15cec1e commit 931f548

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

server/mergin/sync/tasks.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ def optimize_storage(project_id):
102102
if not os.path.exists(item.abs_path):
103103
continue
104104

105+
# skip cleanup if missing corresponding diff file - this should never happen but in case of some inconsistency keep full gpkg on disk
106+
if not os.path.exists(
107+
os.path.join(project.storage.project_dir, item.diff_file.location)
108+
):
109+
continue
110+
105111
age = time.time() - os.path.getmtime(item.abs_path)
106112
if age > Configuration.FILE_EXPIRATION:
107113
move_to_tmp(item.abs_path)

0 commit comments

Comments
 (0)