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

Use with_workunit everywhere #10300

Merged
merged 2 commits into from Jul 9, 2020
Merged

Conversation

gshuflin
Copy link
Contributor

@gshuflin gshuflin commented Jul 9, 2020

This commit changes all call sites that were previously using the public start_workunit/complete_workunit method pair to use the with_workunit method, so that the former two methods can be made private.

@gshuflin gshuflin requested a review from stuhood July 9, 2020 02:36
Copy link
Sponsor Member

@stuhood stuhood left a comment

Choose a reason for hiding this comment

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

Awesome change. Thanks a lot!

Comment on lines 283 to 288
if let Some(workunit_state) = workunit_store::get_workunit_state() {
workunit_state.store.complete_workunit(span_id);
let store = workunit_state.store;
with_workunit(store, workunit_name, metadata, result_future, |_, md| md).await
} else {
result_future.await
}
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

In a followup, it might be useful to expose with_workunit as a static method or a macro that would do the equivalent of these 6 lines in one line.

@gshuflin gshuflin merged commit 9366ac9 into pantsbuild:master Jul 9, 2020
@gshuflin gshuflin deleted the workunit_bugs branch July 9, 2020 20:14
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.

None yet

2 participants