mirror of
https://github.com/crowdsecurity/crowdsec.git
synced 2025-05-11 12:25:53 +02:00
enhance: Move info to reconnect goto
This commit is contained in:
parent
f04b51ba10
commit
b55d9cbe88
1 changed files with 2 additions and 2 deletions
|
@ -585,7 +585,7 @@ func (d *DockerSource) WatchContainer(ctx context.Context, monitChan chan *Conta
|
||||||
// Multiple retry attempts within the error case
|
// Multiple retry attempts within the error case
|
||||||
retries := 0
|
retries := 0
|
||||||
|
|
||||||
d.logger.Infof("Attempting to reconnect to Docker events stream")
|
d.logger.Info("Attempting to reconnect to Docker events stream")
|
||||||
for {
|
for {
|
||||||
// Check for cancellation before sleeping
|
// Check for cancellation before sleeping
|
||||||
select {
|
select {
|
||||||
|
@ -628,13 +628,13 @@ func (d *DockerSource) WatchContainer(ctx context.Context, monitChan chan *Conta
|
||||||
default:
|
default:
|
||||||
// No immediate error, seems to have reconnected successfully
|
// No immediate error, seems to have reconnected successfully
|
||||||
errorRetryBackoff = initialBackoff
|
errorRetryBackoff = initialBackoff
|
||||||
d.logger.Info("Successfully reconnected to Docker events")
|
|
||||||
eventsChan = newEventsChan
|
eventsChan = newEventsChan
|
||||||
errChan = newErrChan
|
errChan = newErrChan
|
||||||
goto reconnected
|
goto reconnected
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
reconnected:
|
reconnected:
|
||||||
|
d.logger.Info("Successfully reconnected to Docker events")
|
||||||
// We check containers after a reconnection because the docker daemon might have restarted
|
// We check containers after a reconnection because the docker daemon might have restarted
|
||||||
// and the container tombs may have self deleted
|
// and the container tombs may have self deleted
|
||||||
d.checkContainers(ctx, monitChan, deleteChan)
|
d.checkContainers(ctx, monitChan, deleteChan)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue