Interleave downloads to not prioritize certain files over the other

parent 1db1dfa2
......@@ -63,9 +63,17 @@ class GeoFileDownloadDispatchWorker
def load_pending_downloads
lfs_object_ids = find_lfs_object_ids(DB_RETRIEVE_BATCH)
objects_ids = find_object_ids(DB_RETRIEVE_BATCH - lfs_object_ids.size)
objects_ids = find_object_ids(DB_RETRIEVE_BATCH)
@pending_downloads = lfs_object_ids + objects_ids
@pending_downloads = interleave(lfs_object_ids, objects_ids)
end
def interleave(first, second)
if first.length >= second.length
first.zip(second)
else
second.zip(first).map(&:reverse)
end.flatten(1).compact.take(DB_RETRIEVE_BATCH)
end
def downloads_remain?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment