Skip to content

Commit

Permalink
fix(dlq): Fix invalid message counting in DLQ consumer (#4400)
Browse files Browse the repository at this point in the history
Still need to count invalid messages in ExitAfterNMessages
  • Loading branch information
lynnagara committed Jun 22, 2023
1 parent 39c86e1 commit 982ac34
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion snuba/consumers/dlq.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from typing import Optional, TypeVar

import rapidjson
from arroyo.dlq import InvalidMessage
from arroyo.processing.strategies.abstract import ProcessingStrategy
from arroyo.types import Message

Expand Down Expand Up @@ -150,7 +151,12 @@ def poll(self) -> None:
def submit(self, message: Message[TPayload]) -> None:
if self.__processed_messages < self.__num_messages_to_process:
self.__last_message_time = time.time()
self.__next_step.submit(message)

try:
self.__next_step.submit(message)
except InvalidMessage:
self.__processed_messages += 1
raise
self.__processed_messages += 1

def close(self) -> None:
Expand Down

0 comments on commit 982ac34

Please sign in to comment.