Mar 24, 2021
--
There’s always another way :).
If you’re reading one message at a time, you can keep a “countdown” value. The pseudo-code:
- Set “deadline” to “now + 10s”
- Wait for the next message (passing “deadline minus now” as your library-specific timeout)
- Handle the message (decrementing your 500)
- If “deadline < now”, loop back to step 2