Run lifecycle hook parallelly
Author: okhowangCreated Jan 6, 2025Updated May 13, 2025
Labelsenhancement
Is your feature request related to a problem? Please describe. lifecycle hook is running one by one. if someone run too long, the hooks after it may be failed by timeout because all hooks share same start/stop timeout.
Describe the solution you'd like
hooks are not depend on each other usually.
can we add a option to make hook run in specific parallelism n.
like fx.New(fx.ParallelHooks(n), ...)
Describe alternatives you've considered
I can start a goroutine in hooks to make it run fastly.
but error can't be catched by fx
Is this a breaking change? No, default is 1 It means no behaviour change with existing code.
Additional context
Source: uber-go/fx