Merge pull request #920 from Quentin-M/fix_secwor

Fix security worker (ok last time before I give up on engineering)
This commit is contained in:
Quentin Machu 2015-11-18 21:24:13 -05:00
commit 450a3e08e0

View file

@ -476,13 +476,13 @@ def get_secscan_candidates(engine_version, batch_size):
ImageStorage.uploading == False) ImageStorage.uploading == False)
.limit(batch_size*10)) .limit(batch_size*10))
if len(candidates) > 0:
images = (Image images = (Image
.select(Image, ImageStorage) .select(Image, ImageStorage)
.join(ImageStorage) .join(ImageStorage)
.where(Image.id << candidates) .where(Image.id << candidates)
.order_by(db_random_func()) .order_by(db_random_func())
.limit(batch_size)) .limit(batch_size))
rimages.extend(images) rimages.extend(images)
# Collect the images with analyzed parents. # Collect the images with analyzed parents.
@ -497,6 +497,7 @@ def get_secscan_candidates(engine_version, batch_size):
ImageStorage.uploading == False) ImageStorage.uploading == False)
.limit(batch_size*10)) .limit(batch_size*10))
if len(candidates) > 0:
images = (Image images = (Image
.select(Image, ImageStorage, Parent, ParentImageStorage) .select(Image, ImageStorage, Parent, ParentImageStorage)
.join(Parent, on=(Image.parent == Parent.id)) .join(Parent, on=(Image.parent == Parent.id))
@ -506,7 +507,6 @@ def get_secscan_candidates(engine_version, batch_size):
.where(Image.id << candidates) .where(Image.id << candidates)
.order_by(db_random_func()) .order_by(db_random_func())
.limit(batch_size)) .limit(batch_size))
rimages.extend(images) rimages.extend(images)
# Shuffle the images, otherwise the images without parents will always be on the top # Shuffle the images, otherwise the images without parents will always be on the top