Package Config:

- rework & optimize listing of dependencies to start or reload component

Package HttpServer:
- fix bug with writing on channel without listen channel

Bump dependencies
This commit is contained in:
nabbar
2023-03-30 17:57:18 +02:00
parent c1ff964cd7
commit 16bcc244dc
3 changed files with 154 additions and 135 deletions

View File

@@ -46,24 +46,30 @@ func (o *sRun) StartWaitNotify(ctx context.Context) {
signal.Notify(quit, syscall.SIGQUIT)
o.initChan()
select {
case <-quit:
_ = o.Stop(ctx)
return
case <-o.getContext().Done():
if o.IsRunning() {
defer o.delChan()
for {
select {
case <-quit:
_ = o.Stop(ctx)
return
case <-o.getContext().Done():
if o.IsRunning() {
_ = o.Stop(ctx)
}
return
case <-o.getChan():
return
}
return
case <-o.getChan():
return
}
}
func (o *sRun) StopWaitNotify() {
o.m.Lock()
defer o.m.Unlock()
o.chn <- struct{}{}
o.m.RLock()
defer o.m.RUnlock()
if o.chn != nil {
o.chn <- struct{}{}
}
}
func (o *sRun) initChan() {
@@ -77,3 +83,12 @@ func (o *sRun) getChan() <-chan struct{} {
defer o.m.RUnlock()
return o.chn
}
func (o *sRun) delChan() {
o.m.Lock()
defer o.m.Unlock()
if o.chn != nil {
close(o.chn)
}
o.chn = nil
}