Skip to content

Commit

Permalink
Get harvest object ids out of redis in one go, instead of pop/push
Browse files Browse the repository at this point in the history
  • Loading branch information
bellisk authored and kentsanggds committed Oct 27, 2020
1 parent bf351d3 commit ef43243
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions ckanext/harvest/queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,8 @@ def resubmit_objects():
objects_in_queue = []
fetch_routing_key = get_fetch_routing_key()

for i in range(redis.llen(fetch_routing_key)):
item = redis.lpop(fetch_routing_key)
objects_in_queue.append(
json.loads(item)['harvest_object_id']
)
redis.rpush(fetch_routing_key, item)
objects_in_queue = [json.loads(o)['harvest_object_id']
for o in redis.lrange(fetch_routing_key, 0, -1)]

for object_id, in waiting_objects:
if object_id not in objects_in_queue:
Expand Down

0 comments on commit ef43243

Please sign in to comment.