Is Watching?
This commit is contained in:
parent
be179e6b68
commit
f5ea23ed2b
2 changed files with 25 additions and 23 deletions
|
@ -48,7 +48,6 @@ func (provider *DockerProvider) Provide(configurationChan chan <- *Configuration
|
||||||
dockerEvents := make(chan *docker.APIEvents)
|
dockerEvents := make(chan *docker.APIEvents)
|
||||||
if (provider.Watch) {
|
if (provider.Watch) {
|
||||||
provider.dockerClient.AddEventListener(dockerEvents)
|
provider.dockerClient.AddEventListener(dockerEvents)
|
||||||
}
|
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
event := <-dockerEvents
|
event := <-dockerEvents
|
||||||
|
@ -59,6 +58,7 @@ func (provider *DockerProvider) Provide(configurationChan chan <- *Configuration
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
configuration := provider.loadDockerConfig()
|
configuration := provider.loadDockerConfig()
|
||||||
configurationChan <- configuration
|
configurationChan <- configuration
|
||||||
|
|
|
@ -47,6 +47,7 @@ func (provider *MarathonProvider) Provide(configurationChan chan <- *Configurati
|
||||||
} else {
|
} else {
|
||||||
provider.marathonClient = client
|
provider.marathonClient = client
|
||||||
update := make(marathon.EventsChannel, 5)
|
update := make(marathon.EventsChannel, 5)
|
||||||
|
if (provider.Watch) {
|
||||||
if err := client.AddEventsListener(update, marathon.EVENTS_APPLICATIONS); err != nil {
|
if err := client.AddEventsListener(update, marathon.EVENTS_APPLICATIONS); err != nil {
|
||||||
log.Println("Failed to register for subscriptions, %s", err)
|
log.Println("Failed to register for subscriptions, %s", err)
|
||||||
} else {
|
} else {
|
||||||
|
@ -61,6 +62,7 @@ func (provider *MarathonProvider) Provide(configurationChan chan <- *Configurati
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
configuration := provider.loadMarathonConfig()
|
configuration := provider.loadMarathonConfig()
|
||||||
configurationChan <- configuration
|
configurationChan <- configuration
|
||||||
|
|
Loading…
Reference in a new issue