Skip to content

Commit ddb11c2

Browse files
change lftp call to avoid hanging
1 parent 89efdd9 commit ddb11c2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ecodev_core/backup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,9 @@ def _get_old_backups(file_to_backup: Path, nb_saves: int) -> List[str]:
8080
"""
8181
Retrieve old versions of file_to_backup in order to erase them (more than nb_saves ago)
8282
"""
83-
output = run(['lftp', '-c', f'open {BACKUP_URL}; ls {file_to_backup.name.split(".")[0]}*'],
83+
output = run(['lftp', '-c', f'open {BACKUP_URL}; ls'],
8484
capture_output=True, text=True)
85-
all_backups = sorted([x.split(' ')[-1] for x in output.stdout.splitlines()])
85+
filename_base = file_to_backup.name.split(".")[0]
86+
all_backups = sorted([x.split(' ')[-1] for x in output.stdout.splitlines() if filename_base in x])
8687
log.info(f'existing remote backups {all_backups}')
8788
return all_backups[:-nb_saves]

0 commit comments

Comments
 (0)