Repository navigation
Conversation
Partition the batch so AddTagToWorkflow/RemoveTagFromWorkflow always go through the optimized bulk path (2 storage calls), regardless of what other message types are in the batch. Previously, a single ContinueWorkflowTagFanout or other message type in the batch would force ALL messages into the sequential fallback path (O(N) storage calls). Refs infiniticio#297
Ouriel
force-pushed
the
fix/batch-fastpath-mixed-messages
branch
from
April 25, 2026 19:55
44f5c0a to
173f01b
Compare
Collaborator
|
Redundant with 0.18.4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Refs #297 — Ensures
AddTagToWorkflow/RemoveTagFromWorkflowmessages always use the optimized bulk storage path, even when other message types are in the same batch.Problem
batchProcess()has a fast-path (batchProcessAddRemoveOnly) that does a single bulk Redis read + single bulk Redis write (2 storage calls regardless of batch size). However, this fast-path only activates when all messages in the batch are add/remove.When any other message type is present (e.g.,
ContinueWorkflowTagFanout,DispatchWorkflowByCustomId), the entire batch falls into the sequential fallback path where each message hits storage individually — O(N) calls.Production metrics showed
AddTagToWorkflowlatency went from sub-ms to 6.5s because these messages were stuck in mixed batches.Fix
Partition the batch: add/remove messages always go through the bulk path, other messages are processed separately per tag.
What was tested
All 10 existing tests pass, including the batch equivalence test that verifies batch and one-by-one processing produce identical results.