Change the security scan update query to only change the indexed row
This will mean we try to re-index other similar rows, but that's a no-op on the Clair side, and this update query is extremely heavy and easily interleaving locks
This commit is contained in:
parent
154c17bd3c
commit
10ee6be442
1 changed files with 1 additions and 11 deletions
|
@ -463,19 +463,9 @@ def get_image_with_storage_and_parent_base():
|
||||||
|
|
||||||
|
|
||||||
def set_secscan_status(image, indexed, version):
|
def set_secscan_status(image, indexed, version):
|
||||||
query = (Image
|
|
||||||
.select()
|
|
||||||
.join(ImageStorage)
|
|
||||||
.where(Image.docker_image_id == image.docker_image_id,
|
|
||||||
ImageStorage.uuid == image.storage.uuid))
|
|
||||||
|
|
||||||
ids_to_update = [row.id for row in query]
|
|
||||||
if not ids_to_update:
|
|
||||||
return False
|
|
||||||
|
|
||||||
return (Image
|
return (Image
|
||||||
.update(security_indexed=indexed, security_indexed_engine=version)
|
.update(security_indexed=indexed, security_indexed_engine=version)
|
||||||
.where(Image.id << ids_to_update)
|
.where(Image.id == image.id)
|
||||||
.where((Image.security_indexed_engine != version) | (Image.security_indexed != indexed))
|
.where((Image.security_indexed_engine != version) | (Image.security_indexed != indexed))
|
||||||
.execute()) != 0
|
.execute()) != 0
|
||||||
|
|
||||||
|
|
Reference in a new issue