Skip to content

Commit 380dd83

Browse files
committed
fix(probe): Use a buffered chan to reduce the chance of losing events
Event notifications from Docker will be dropped if not collected quickly enough; using a buffered chan reduces the chance of this happening.
1 parent 7cf5712 commit 380dd83

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

probe/docker/registry.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,9 @@ func (r *registry) listenForEvents() bool {
176176
// Next, start listening for events. We do this before fetching
177177
// the list of containers so we don't miss containers created
178178
// after listing but before listening for events.
179-
events := make(chan *docker_client.APIEvents)
179+
// Use a buffered chan so the client library can run ahead of the listener
180+
// - Docker will drop an event if it is not collected quickly enough.
181+
events := make(chan *docker_client.APIEvents, 1024)
180182
if err := r.client.AddEventListener(events); err != nil {
181183
log.Errorf("docker registry: %s", err)
182184
return true

0 commit comments

Comments
 (0)