Skip to content

feat: add flush method to Producer - #103

Merged
quettabit merged 1 commit into
mainfrom
qb/producer-flush
Aug 17, 2026
Merged

feat: add flush method to Producer#103
quettabit merged 1 commit into
mainfrom
qb/producer-flush

Conversation

@quettabit

Copy link
Copy Markdown
Member

No description provided.

@quettabit quettabit changed the title [WIP] feat: add flush method to Producer Aug 17, 2026
@quettabit

Copy link
Copy Markdown
Member Author

@greptileai review pls

@greptile-apps

greptile-apps Bot commented Aug 17, 2026

Copy link
Copy Markdown

Greptile Summary

Adds a public Producer.flush() method that submits the current partial batch and waits until all previously submitted records are acknowledged.

  • Tracks acknowledgement completion with one future per unacknowledged batch.
  • Renames internal flush-related state and methods to distinguish batch submission from acknowledgement draining.
  • Adds coverage for flushing full and partial batches while continuing to use the producer afterward.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/s2_sdk/_producer.py Adds flush semantics and per-batch acknowledgement-completion tracking while preserving terminal-error propagation.
tests/test_stream_ops.py Verifies that flush submits a partial batch, resolves earlier tickets, and permits subsequent submissions.

Sequence Diagram

sequenceDiagram
    participant Caller
    participant Producer
    participant Session
    participant Drainer
    Caller->>Producer: flush()
    Producer->>Session: submit accumulated batch
    Session-->>Producer: BatchSubmitTicket
    Producer->>Drainer: wake acknowledgement task
    Drainer->>Session: await ticket
    Session-->>Drainer: append acknowledgement
    Drainer->>Producer: resolve batch completion future
    Producer-->>Caller: flush completes
Loading

Reviews (3): Last reviewed commit: "initial commit" | Re-trigger Greptile

Comment thread src/s2_sdk/_producer.py
@quettabit

Copy link
Copy Markdown
Member Author

@greptileai addressed your comments. pls review again.

@quettabit

Copy link
Copy Markdown
Member Author

@greptileai what other concerns do you have? can you pls convey em through comments on relevant blocks/lines?

@quettabit
quettabit marked this pull request as ready for review August 17, 2026 19:39
@quettabit
quettabit requested a review from a team as a code owner August 17, 2026 19:39
@quettabit
quettabit merged commit 4b896b7 into main Aug 17, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant