Skip to content

feat(pipeline): cancel dispatch on collector persistence failure - #604

Merged
j-mok-dev merged 4 commits into
mainfrom
feat-595-dispatch-cancel-on-failure
Jul 17, 2026
Merged

feat(pipeline): cancel dispatch on collector persistence failure#604
j-mok-dev merged 4 commits into
mainfrom
feat-595-dispatch-cancel-on-failure

Conversation

@j-mok-dev

Copy link
Copy Markdown
Collaborator

Why is this PR needed?

When the collector encounters a persistence failure (disk write error), dispatch and inference work continue until all requests complete — wasting resources on results that can never be durably recorded. (#595)

What does this PR do?

Introduces a split-context pattern in the pipeline executor:

  • dispatchCtx (child of errgroup ctx) → passed to source and dispatcher
  • Parent ctx → passed to collector (unchanged)

On the first write error, the collector invokes a sync.OnceFunc callback that cancels dispatchCtx. The existing PreDispatcher/AIMD cancel-drain path stops new work immediately. The collector continues draining resultCh until close to avoid deadlocking senders, then returns the persistence error.

No changes to the collector's drain-until-close contract, worker error routing, cancel code logic, or async dispatcher cancel/drain flow.

How was this tested?

Checklist

Related Issues

Closes #595

@github-actions

Copy link
Copy Markdown

Unsigned commits detected! Please sign your commits.

For instructions on how to set up GPG/SSH signing and verify your commits, please see GitHub Documentation.

When the result collector encounters a write error, it now signals the
executor to cancel dispatch immediately. This prevents wasting inference
work after durable persistence has already failed.

The executor owns a split context: source and dispatcher receive
dispatchCtx (cancelled on persistence failure), while the collector
continues draining resultCh until close to avoid deadlocking senders.

Closes #595

Signed-off-by: Jooyeon Mok <jmok@redhat.com>
@j-mok-dev
j-mok-dev force-pushed the feat-595-dispatch-cancel-on-failure branch from 1719dbc to fda05df Compare July 17, 2026 18:00
@j-mok-dev
j-mok-dev enabled auto-merge (squash) July 17, 2026 20:04
@j-mok-dev
j-mok-dev merged commit 3dcdefe into main Jul 17, 2026
6 checks passed
@j-mok-dev
j-mok-dev deleted the feat-595-dispatch-cancel-on-failure branch July 17, 2026 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cancel dispatch on collector persistence failure while preserving drain

2 participants