Merge pull request #1136 from jakedt/fixdeleteagain
Clean up torrents before removing referenced storages
This commit is contained in:
commit
ec6efa0217
1 changed files with 6 additions and 0 deletions
|
@ -69,6 +69,12 @@ def garbage_collect_storage(storage_id_whitelist):
|
|||
storage_id_whitelist,
|
||||
(ImageStorage.id,)).alias('osq'))
|
||||
if len(orphaned_storages) > 0:
|
||||
torrents_removed = (TorrentInfo
|
||||
.delete()
|
||||
.where(TorrentInfo.storage << orphaned_storages)
|
||||
.execute())
|
||||
logger.debug('Removed %s torrent info records', torrents_removed)
|
||||
|
||||
storages_removed = (ImageStorage
|
||||
.delete()
|
||||
.where(ImageStorage.id << orphaned_storages)
|
||||
|
|
Reference in a new issue