Skip to content

chore: spawn actors after sync#2144

Open
SantiagoPittella wants to merge 2 commits into
nextfrom
santiagopittella-ntx-builder-block-sub-phase-2
Open

chore: spawn actors after sync#2144
SantiagoPittella wants to merge 2 commits into
nextfrom
santiagopittella-ntx-builder-block-sub-phase-2

Conversation

@SantiagoPittella
Copy link
Copy Markdown
Collaborator

Second PR of the ntx-builder block-subscription refactor. PR 1 left the actors deactivated behind a subscription-driven sync loop. This PR reintroduces the actor lifecycle driven by committed blocks.

The builder now runs three steps:

  1. catch-up,
  2. a one-shot boundary that spawns an actor per account with carry-over pending notes,
  3. a steady-state loop that applies each block then has the coordinator spawn actors for newly note-targeted accounts and wake the rest.

The coordinator is now a pure lifecycle owner (handle_committed_block) with the old mempool-shape write_event/send_targeted removed, and chain state is shared with actors via Arc<SharedChainState>.

Actors here are lifecycle-only: an actor waits for its account to be committed locally, then idles on notify/timeout. No transactions are built or submitted yet (will be reconnected in PR 3).

@SantiagoPittella SantiagoPittella added the no changelog This PR does not require an entry in the `CHANGELOG.md` file label May 26, 2026
@SantiagoPittella SantiagoPittella force-pushed the santiagopittella-ntx-builder-block-sub-phase-2 branch from b27ba78 to 207b4eb Compare May 26, 2026 20:47
Comment on lines +147 to +149
for account_id in pending_accounts {
self.coordinator.spawn_actor(account_id);
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We should retain a database connection permanently in this event loop.

Otherwise we run the risk that actors will hold all connections in the pool, starving the main loop.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I created a pinned connection for this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no changelog This PR does not require an entry in the `CHANGELOG.md` file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants