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