-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathready.go
More file actions
24 lines (22 loc) · 606 Bytes
/
Copy pathready.go
File metadata and controls
24 lines (22 loc) · 606 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package docker
import "time"
// Ready signals when the plugin is ready for use.
func (d *Docker) Ready() bool {
d.mu.RLock()
defer d.mu.RUnlock()
if d.client == nil {
log.Debugf("Ready check: not ready (no Docker client)")
return false
}
if d.connected {
log.Debugf("Ready check: ready (connected to Docker daemon)")
return true
}
ready := !d.lastSyncTime.IsZero()
if ready {
log.Debugf("Ready check: ready (serving stale records, last sync: %s)", d.lastSyncTime.Format(time.RFC3339))
} else {
log.Debugf("Ready check: not ready (disconnected, no previous sync)")
}
return ready
}