enhance: Move info outside for loop

This commit is contained in:
Laurence 2025-05-02 14:12:30 +01:00
parent 38810df96b
commit f04b51ba10
No known key found for this signature in database
GPG key ID: B053BEE3478E8FEF

View file

@ -585,6 +585,7 @@ func (d *DockerSource) WatchContainer(ctx context.Context, monitChan chan *Conta
// Multiple retry attempts within the error case
retries := 0
d.logger.Infof("Attempting to reconnect to Docker events stream")
for {
// Check for cancellation before sleeping
select {
@ -610,7 +611,6 @@ func (d *DockerSource) WatchContainer(ctx context.Context, monitChan chan *Conta
}
// Try to reconnect
d.logger.Infof("Attempting to reconnect to Docker events stream")
newEventsChan, newErrChan := d.Client.Events(ctx, options)
// Check if connection is immediately broken