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

[narwhal] add log statements to easily trace when tasks shutdown #6696

Merged
merged 1 commit into from
Dec 14, 2022

Conversation

akichidis
Copy link
Contributor

@akichidis akichidis commented Dec 9, 2022

This PR extends the spawn_monitored_task macro and introduces the spawn_logged_monitored_task in order to provide extra capabilities to print log statements when the passed in task future starts/ends. It also introduces the ability to add names for our tasks so we can easily identify them

Comment on lines 290 to 292
spawn_monitored_task!(s.run()).tap(|_| {
info!("Consensus task shutdown");
})
Copy link
Contributor

Choose a reason for hiding this comment

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

This does not do what you think it does. This will immediately return and print the log statement.

Copy link
Contributor

Choose a reason for hiding this comment

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

If you want a statement to be printed when the task itself finishes, you'll want to directly instrument the future that's being spawned.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh my that's embarrassing - can't even think why I did it this way - I'll refactor , thanks @bmwill !

Copy link
Contributor

Choose a reason for hiding this comment

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

haha no worries, i've made similar mistakes before which is why i knew this wouldn't do what you want it to :)

Copy link
Contributor

Choose a reason for hiding this comment

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

I would have made the same mistake! Thanks @bmwill

Copy link
Contributor

@asonnino asonnino left a comment

Choose a reason for hiding this comment

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

Except @bmwill comment the PR looks good

Comment on lines 290 to 292
spawn_monitored_task!(s.run()).tap(|_| {
info!("Consensus task shutdown");
})
Copy link
Contributor

Choose a reason for hiding this comment

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

I would have made the same mistake! Thanks @bmwill

@vercel
Copy link

vercel bot commented Dec 13, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated
wallet-adapter ⬜️ Ignored (Inspect) Dec 14, 2022 at 1:37PM (UTC)

Copy link
Contributor

@bmwill bmwill left a comment

Choose a reason for hiding this comment

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

a lot more robust!

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.

3 participants