handle queues vanishing during peek
Handle queues getting deleted during peek_queue.  This can happen when
polling the pool for work while the pool is getting shut down.
@@ -158,6 +158,7 @@ def peek_queue(
if max_messages < MIN_PEEK_SIZE or max_messages > MAX_PEEK_SIZE:
raise ValueError("invalid max messages: %s" % max_messages)
+ try:
queue = get_queue(name, storage_type)
if not queue:
return result
@@ -166,6 +167,8 @@ def peek_queue(
decoded = base64.b64decode(message.content)
raw = json.loads(decoded)
result.append(object_type.parse_obj(raw))
+ except ResourceNotFoundError:
+ return result
return result
