We can't even use an empty in query for images.
This commit is contained in:
parent
ebacdec054
commit
efe8825a15
1 changed files with 5 additions and 5 deletions
|
@ -1389,13 +1389,13 @@ def garbage_collect_repository(namespace_name, repository_name):
|
|||
all_images = {int(img.id): img for img in all_repo_images}
|
||||
to_remove = set(all_images.keys()).difference(referenced_anscestors)
|
||||
|
||||
storage_id_whitelist = {all_images[to_remove_id].storage.id for to_remove_id in to_remove}
|
||||
if len(to_remove) > 0:
|
||||
logger.info('Cleaning up unreferenced images: %s', to_remove)
|
||||
storage_id_whitelist = {all_images[to_remove_id].storage.id for to_remove_id in to_remove}
|
||||
|
||||
logger.info('Cleaning up unreferenced images: %s', to_remove)
|
||||
Image.delete().where(Image.id << list(to_remove)).execute()
|
||||
Image.delete().where(Image.id << list(to_remove)).execute()
|
||||
|
||||
if len(storage_id_whitelist) > 0:
|
||||
garbage_collect_storage(storage_id_whitelist)
|
||||
garbage_collect_storage(storage_id_whitelist)
|
||||
|
||||
return len(to_remove)
|
||||
|
||||
|
|
Reference in a new issue