Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pd: 👯 use tokio's JoinSet for polling servers #3680

Open
cratelyn opened this issue Jan 26, 2024 · 0 comments
Open

pd: 👯 use tokio's JoinSet for polling servers #3680

cratelyn opened this issue Jan 26, 2024 · 0 comments
Labels
A-node Area: System design and implementation for node software C-enhancement Category: an enhancement to the codebase _P-low Priority: low

Comments

@cratelyn
Copy link
Contributor

in pd's startup code, we use tokio::select! to poll a bundle of futures, none of which should return until an error is encountered.

this would be a great opportunity to use tokio::task::JoinSet, which has recently been added to the library beneath the rt feature flag.

quoth the docs:

A JoinSet can be used to await the completion of some or all of the tasks in the set. The set is not ordered, and the tasks will be returned in the order they complete.

All of the tasks must have the same return type T.

When the JoinSet is dropped, all tasks in the JoinSet are immediately aborted.

these properties (particularly grouping up tasks to abort upon failure/shutdown) are all what we want, and it exposes (imo) a friendlier interface than the alternate macro syntax.

additionally, it would make it much easier to propagate errors from other subsystems, e.g. ACME events (see #3652), to be fatal.

cc: @conorsch 🔖

@cratelyn cratelyn added A-node Area: System design and implementation for node software C-enhancement Category: an enhancement to the codebase labels Jan 26, 2024
@cratelyn cratelyn added the _P-low Priority: low label Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-node Area: System design and implementation for node software C-enhancement Category: an enhancement to the codebase _P-low Priority: low
Projects
Status: Backlog
Status: No status
Development

No branches or pull requests

1 participant