Remove eventloop package
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
parent
4de168877b
commit
4e05bf491a
15 changed files with 265 additions and 359 deletions
|
@ -1,14 +1,21 @@
|
|||
package supervisor
|
||||
|
||||
import "time"
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/docker/containerd/runtime"
|
||||
)
|
||||
|
||||
type StatsTask struct {
|
||||
s *Supervisor
|
||||
baseTask
|
||||
ID string
|
||||
Stat chan *runtime.Stat
|
||||
Err chan error
|
||||
}
|
||||
|
||||
func (h *StatsTask) Handle(e *Task) error {
|
||||
func (s *Supervisor) stats(t *StatsTask) error {
|
||||
start := time.Now()
|
||||
i, ok := h.s.containers[e.ID]
|
||||
i, ok := s.containers[t.ID]
|
||||
if !ok {
|
||||
return ErrContainerNotFound
|
||||
}
|
||||
|
@ -16,12 +23,12 @@ func (h *StatsTask) Handle(e *Task) error {
|
|||
go func() {
|
||||
s, err := i.container.Stats()
|
||||
if err != nil {
|
||||
e.Err <- err
|
||||
t.Err <- err
|
||||
return
|
||||
}
|
||||
e.Err <- nil
|
||||
e.Stat <- s
|
||||
t.Err <- nil
|
||||
t.Stat <- s
|
||||
ContainerStatsTimer.UpdateSince(start)
|
||||
}()
|
||||
return errDeferedResponse
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue