Closed GreyXor closed 2 months ago
Attention: 6 lines
in your changes are missing coverage. Please review.
Comparison is base (
c635315
) 86.09% compared to head (7a5c686
) 85.99%.
Files | Patch % | Lines |
---|---|---|
root_scope.go | 0.00% | 6 Missing :warning: |
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Can you develop your use case please ?
Why not just call injector.Shutdown()
when you need a custom shutdown logic?
I give the channel to my API so I can shutdown my server from it.
Yes for now I manage to do it by calling Injector.Shutdown()
it's working as expected.
This solution just allows me to not write the signal waiting, which just saves me a few lines of code.
We recently removed some Shutdown****
helpers for simplicity. I'm not sure we want to support more cases here.
Also, I think sending a os.Signal
into this channel is unsafe, since the Shutdown
helper might listen to different signals.
IMO, it's better to wait with:
ch := make(chan struct{}{})
go func() {
<-ch
injector.Shutdown()
}()
I will keep this PR open for further discussion.
ch := make(chan struct{}{}) go func() { <-ch injector.Shutdown() }()
Yes, that's how i'm doing it so far, and it's working well. We can keep it like that
Passing your own channel as an argument to these methods allows you to have control over the communication channel used to receive signals. That is very useful for my custom signal handling logic.