Skip to content

Release completed keyed partition state - #503

Open
akshitkhokhani wants to merge 1 commit into
python-streamz:masterfrom
akshitkhokhani:codex/streamz-batch-review
Open

akshitkhokhani wants to merge 1 commit into
python-streamz:masterfrom
akshitkhokhani:codex/streamz-batch-review

Conversation

@akshitkhokhani

Copy link
Copy Markdown

Keyed partition currently leaves completed keys in _buffer and _metadata_buffer; it also retains timer entries for batches that scheduled a timeout. A long-lived stream therefore keeps per-key bookkeeping for every distinct completed key.

Remove those entries before delivering the completed batch. Removing them before awaiting downstream work lets a new batch for the same key retain its own buffers and timer. Batch contents and the stream's existing latest-value behavior are unchanged. This is separate from the partition_unique metadata-reference work in #502.

Validation on macOS ARM64, Python 3.13.7, pinned upstream 5267116f49fc2257e39b44abd8d1e5c5460715f8:

  • Six regression cases fail on the original implementation and pass with the change: size-one/two batches, with/without timeouts, actual timeout flushing, and same-key input while an asynchronous sink is waiting.
  • Full streamz/tests/test_core.py: 129 passed, 2 skipped.
  • flake8 streamz and git diff --check pass.

Tests use small synthetic inputs in a local checkout with networking denied. The full optional-integration suite and other Python/platform combinations were not run.

AI disclosure: prepared and tested with Codex under the account owner's authorization, with independent review by a separate Codex agent. No human review is claimed.

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