worker: Allow long MissedMessageWorker consumes.

This will stop dropping events in the case that the background
`maybe_send_batched_email` thread takes longer than 30s.  However, see
also #15280 and the TODO comment about how we lose events upon
restart; this worker is still lossy.
This commit is contained in:
Alex Vandiver 2021-05-03 18:19:27 -07:00 committed by Tim Abbott
parent d5559e1e7b
commit a9688ceb75
1 changed files with 6 additions and 0 deletions

View File

@ -561,6 +561,12 @@ class MissedMessageWorker(QueueProcessingWorker):
# of the consumer.
lock = Lock()
# Because the background `maybe_send_batched_email` thread can
# hold the lock for an indeterminate amount of time, the `consume`
# can block on that for longer than 30s, the default worker
# timeout. Allow arbitrarily-long worker `consume` calls.
MAX_CONSUME_SECONDS = None
def consume(self, event: Dict[str, Any]) -> None:
with self.lock:
logging.debug("Received missedmessage_emails event: %s", event)