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

Fix Invoke order when fx.Module is used #925

Merged
merged 2 commits into from Aug 19, 2022
Merged

Conversation

sywhang
Copy link
Contributor

@sywhang sywhang commented Aug 19, 2022

Currently, fx.Module's invokes are run after all the invokes provided
at the parent level are invoked.

This makes it difficult for module consumers to control the precise
invoke orders.

This changes the invoke order to run all the invokes in the child
module before running any of the invokes in the parent module, and
clarify that order in the documentation for Invoke.

Solves #918.
Refs GO-1591.

@sywhang sywhang requested a review from abhinav August 19, 2022 07:25
@codecov
Copy link

codecov bot commented Aug 19, 2022

Codecov Report

Merging #925 (57b0737) into master (7a3d15e) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #925   +/-   ##
=======================================
  Coverage   98.72%   98.72%           
=======================================
  Files          30       30           
  Lines        1332     1332           
=======================================
  Hits         1315     1315           
  Misses         11       11           
  Partials        6        6           
Impacted Files Coverage Δ
invoke.go 100.00% <ø> (ø)
module.go 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Currently, fx.Module's invokes are run after all the invokes provided
at the parent level are invoked.

This makes it difficult for module consumers to control the precise
invoke orders.

This changes the invoke order to run all the invokes in the child
module before running any of the invokes in the parent module, and
clarify that order in the documentation for Invoke.

Solves uber-go#918.
Refs GO-1591.
Copy link
Contributor

@r-hang r-hang left a comment

Choose a reason for hiding this comment

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

lgtm!

@sywhang sywhang merged commit f54e56f into uber-go:master Aug 19, 2022
@sywhang sywhang deleted the invoke-order branch August 19, 2022 22:20
sywhang added a commit to sywhang/fx that referenced this pull request Oct 11, 2022
* Fix Invoke order when fx.Module is used

Currently, fx.Module's invokes are run after all the invokes provided
at the parent level are invoked.

This makes it difficult for module consumers to control the precise
invoke orders.

This changes the invoke order to run all the invokes in the child
module before running any of the invokes in the parent module, and
clarify that order in the documentation for Invoke.

Solves uber-go#918.
Refs GO-1591.

* fix indentation in code sample
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants