This repository was archived by the owner on Jan 27, 2026. It is now read-only.
refactor: task startup and shutdown across binaries#630
Closed
itzlambda wants to merge 3 commits intoPrimeIntellect-ai:noot/libp2p-discoveryfrom
Closed
refactor: task startup and shutdown across binaries#630itzlambda wants to merge 3 commits intoPrimeIntellect-ai:noot/libp2p-discoveryfrom
itzlambda wants to merge 3 commits intoPrimeIntellect-ai:noot/libp2p-discoveryfrom
Conversation
Author
|
Noticed there where many changes which would cause merge conflict in #629, so have based this branch on top of it. After that PR is merged will rebase to main. |
itzlambda
commented
Jul 20, 2025
| #[tokio::main] | ||
| async fn main() -> Result<(), Box<dyn std::error::Error>> { | ||
| // TODO: see if there are any better DS to handle this | ||
| let task_handles: TaskHandles = Arc::new(Mutex::new(Vec::<JoinHandle<()>>::new())); |
Author
There was a problem hiding this comment.
do we need to keep JoinHandle to all the tasks? iiuc these are only needed to call abort.
i was wondering if we can use TaskTracker instead to simplify and not needing to handle locks.
after cancellation tokens are properly setup we dont need to worry about manually calling abort to handles, and if even with cancellation token task take more than configured time to complete we are anyways going to shutdown (i.e. dropping runtime, which stops all the tasks) so calling abort on those rare cases shouldn't be required.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix: #627