Skip to content

Commit 9a63121

Browse files
committed
fixes healthcheck
1 parent 00a9556 commit 9a63121

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

internal/docker/container_store.go

+9
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,15 @@ func (s *ContainerStore) init(ctx context.Context) {
100100
log.Debugf("container %s died", container.ID)
101101
container.State = "exited"
102102
}
103+
case "health_status: healthy", "health_status: unhealthy":
104+
healthy := "unhealthy"
105+
if event.Name == "health_status: healthy" {
106+
healthy = "healthy"
107+
}
108+
if container, ok := s.containers[event.ActorID]; ok {
109+
log.Debugf("container %s is %s", container.ID, healthy)
110+
container.Health = healthy
111+
}
103112
}
104113

105114
for _, sub := range s.subscribers {

internal/web/events.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,7 @@ func (h *handler) streamEvents(w http.ResponseWriter, r *http.Request) {
117117
return
118118
}
119119
f.Flush()
120-
default:
121-
log.Tracef("ignoring docker event: %v", event.Name)
122-
// do nothing
120+
123121
}
124122
case <-ctx.Done():
125123
log.Debugf("context done, closing event stream")

0 commit comments

Comments
 (0)