Browse Source

En cours de développement

master
mls-361 1 year ago
parent
commit
18b137704d
  1. 27
      internal/supervisor/supervisor.go

27
internal/supervisor/supervisor.go

@ -73,24 +73,22 @@ func (s *Supervisor) loop() error {
end := false
timer := time.NewTimer(0)
ticker := time.NewTicker(time.Millisecond)
for {
select {
case <-timer.C:
timer.Reset(s.supervise())
case <-ticker.C:
ticker.Reset(s.supervise())
case <-endCh:
if end {
break
}
if !timer.Stop() {
<-timer.C
}
ticker.Stop()
s.ege.Stop()
end = true
s.ege.Stop()
case err := <-s.ege.EndCh():
s.ege.Wait()
@ -110,6 +108,21 @@ func (s *Supervisor) Run() error {
s.logger = logger
app := s.app
logger.Info( //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
"BEGIN",
"id", app.ID(),
"name", app.Name(),
"version", app.Version(),
"builtAt", app.BuiltAt().String(),
"pid", os.Getpid(),
)
defer func() {
logger.Info("END", "uptime", time.Since(app.StartedAt()).String()) //:::::::::::::::::::::::::::::::::::::::::::
}()
s.ege.Start(logger)
return s.loop()

Loading…
Cancel
Save