mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-20 12:42:34 +02:00
refactor: enhance idlewatcher logging and exit handling
This commit is contained in:
parent
78bed43199
commit
0a13bcb8a3
1 changed files with 6 additions and 2 deletions
|
@ -160,7 +160,7 @@ func NewWatcher(parent task.Parent, r routes.Route) (*Watcher, error) {
|
||||||
watcherMap[key] = w
|
watcherMap[key] = w
|
||||||
go func() {
|
go func() {
|
||||||
cause := w.watchUntilDestroy()
|
cause := w.watchUntilDestroy()
|
||||||
if cause.Is(causeContainerDestroy) {
|
if cause.Is(causeContainerDestroy) || cause.Is(task.ErrProgramExiting) {
|
||||||
watcherMapMu.Lock()
|
watcherMapMu.Lock()
|
||||||
defer watcherMapMu.Unlock()
|
defer watcherMapMu.Unlock()
|
||||||
delete(watcherMap, key)
|
delete(watcherMap, key)
|
||||||
|
@ -173,7 +173,11 @@ func NewWatcher(parent task.Parent, r routes.Route) (*Watcher, error) {
|
||||||
w.provider.Close()
|
w.provider.Close()
|
||||||
w.task.Finish(cause)
|
w.task.Finish(cause)
|
||||||
}()
|
}()
|
||||||
w.l.Info().Msg("idlewatcher started")
|
if exists {
|
||||||
|
w.l.Info().Msg("idlewatcher reloaded")
|
||||||
|
} else {
|
||||||
|
w.l.Info().Msg("idlewatcher started")
|
||||||
|
}
|
||||||
return w, nil
|
return w, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue