A question about heartbeats in push consumers. #1967
Unanswered
kafkiansky
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello. I'm writing a NATS client for non-blocking PHP, using your official client as a reference, and I have a question regarding heartbeat processing behavior in push consumers.
Looking at this code, it appears that when a message is received, we stop the heartbeat timeout timer (which makes sense, as we're busy processing the message), and then reset the timer to start waiting for heartbeats again. However, while we're processing the message, heartbeats from NATS continue to arrive, but instead of being processed immediately, they queue up in memory. After the message processing completes, the handler is called for each accumulated heartbeat, resulting in continuous timer stops and resets (see the image below).
Is this the correct behavior? Would it be acceptable to discard these heartbeats while we're busy processing a message?
Beta Was this translation helpful? Give feedback.
All reactions