Skip to content

Commit 7eeffa4

Browse files
committed
Handling the case where there are no items in the queue.
RE:natcap#1580
1 parent 63c1b18 commit 7eeffa4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

codesigning/gcp-cloudfunc/main.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,12 @@ def main(request):
6060
with get_lock():
6161
queuefile = bucket.blob('queue.json')
6262
queue_dict = json.loads(queuefile.download_as_string())
63-
next_file_url = queue_dict['queue'].pop(0)
63+
try:
64+
next_file_url = queue_dict['queue'].pop(0)
65+
except IndexError:
66+
# No items in the queue!
67+
return jsonify('No items in the queue'), 204
68+
6469
queuefile.upload_from_string(json.dumps(queue_dict))
6570

6671
data = {

0 commit comments

Comments
 (0)