mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-19 20:32:35 +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
|
||||
go func() {
|
||||
cause := w.watchUntilDestroy()
|
||||
if cause.Is(causeContainerDestroy) {
|
||||
if cause.Is(causeContainerDestroy) || cause.Is(task.ErrProgramExiting) {
|
||||
watcherMapMu.Lock()
|
||||
defer watcherMapMu.Unlock()
|
||||
delete(watcherMap, key)
|
||||
|
@ -173,7 +173,11 @@ func NewWatcher(parent task.Parent, r routes.Route) (*Watcher, error) {
|
|||
w.provider.Close()
|
||||
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
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue