Skip to content

11 - API (feat): Use Litestart Channels/Subscriptions - #237

Draft
RobertRosca wants to merge 6 commits into
feat/litestar-stores-sessionsfrom
feat/channels-subscriptions
Draft

11 - API (feat): Use Litestart Channels/Subscriptions#237
RobertRosca wants to merge 6 commits into
feat/litestar-stores-sessionsfrom
feat/channels-subscriptions

Conversation

@RobertRosca

Copy link
Copy Markdown
Member

Stack created with GitHub Stacks CLIGive Feedback 💬

@RobertRosca
RobertRosca force-pushed the feat/channels-subscriptions branch from d397644 to dda205d Compare July 17, 2026 06:20
@RobertRosca
RobertRosca force-pushed the feat/channels-subscriptions branch 3 times, most recently from f81a3d7 to f10fdb8 Compare July 17, 2026 09:09
@RobertRosca
RobertRosca force-pushed the feat/channels-subscriptions branch from f10fdb8 to ab57cd8 Compare July 17, 2026 09:11
@RobertRosca
RobertRosca force-pushed the feat/channels-subscriptions branch 2 times, most recently from 5524190 to 2583f48 Compare July 17, 2026 09:12
@RobertRosca
RobertRosca force-pushed the feat/channels-subscriptions branch from 2583f48 to 5da60aa Compare July 17, 2026 10:46
@RobertRosca
RobertRosca force-pushed the feat/channels-subscriptions branch 2 times, most recently from 008305e to ee4d138 Compare July 20, 2026 09:25
@RobertRosca
RobertRosca force-pushed the feat/channels-subscriptions branch from ee4d138 to 14ed97e Compare July 20, 2026 09:28
@RobertRosca
RobertRosca force-pushed the feat/channels-subscriptions branch from 14ed97e to 78b6550 Compare July 20, 2026 09:30

@CammilleCC CammilleCC left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a fan of this change ☺️ it makes subscriptions more robust and scalable. Just have some clarifying questions.

"""Ensure a poll task is running for the proposal."""
task = self._tasks.get(proposal_number)
if task is None or task.done():
self._tasks[proposal_number] = asyncio.create_task(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When do we close this background task? (e.g., no more subscribed clients).

# Subscribers consume per-proposal channels; the composition-selected
# publisher (built in the lifespan) produces the events. The in-memory
# backend is process-local (ADR-009).
channels_plugin = ChannelsPlugin(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should have more boundaries here to be safe. I’ve seen a max_backlog that we can use.


latest_ts = max(run_timestamps.values(), default=start_at)

repo.invalidate_metadata_cache()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that this is similar to the current behavior, it’s just that this line looks expensive, especially if one reprocesses hundreds of lines at the same time.

Would it be possible to lock or cache the metadata instead?

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.

2 participants