This allows Parallafka clients to choose a commit delay for handling messages. A delay of TimeSpan.Zero means the handled messages will commit as quickly as possible. Any other delay means that commits will happen within that delay. If the message queue is filled, commits occur ASAP.
This approach is more efficient than what it replaces:
1) There is no infinite loop that attempts to commit messages even when no messages were handled
2) All messages are committed within the delay timespan
3) The commit timer starts the moment a message handler completes
Note: includes code from #7 and #5
Testing results:
Given:
test suite of ~100k messages
50ms fake commit (no actual commit so test can re-run each time)
Message handler is a Noop, simply logs the message count, time
This allows Parallafka clients to choose a commit delay for handling messages. A delay of TimeSpan.Zero means the handled messages will commit as quickly as possible. Any other delay means that commits will happen within that delay. If the message queue is filled, commits occur ASAP.
This approach is more efficient than what it replaces: 1) There is no infinite loop that attempts to commit messages even when no messages were handled 2) All messages are committed within the delay timespan 3) The commit timer starts the moment a message handler completes
Note: includes code from #7 and #5
Testing results: Given:
Run times: 1000 MaxQueuedMessages: ~9 seconds, 75 commits 100_000 MaxQueuedMessages: ~6 seconds, 3 commits