Skip to content

Commit

Permalink
fix for issue #153
Browse files Browse the repository at this point in the history
  • Loading branch information
rwynn committed Jan 14, 2019
1 parent d032629 commit 039929b
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions monstache.go
Expand Up @@ -3793,9 +3793,6 @@ func main() {
if err != nil {
panic(fmt.Sprintf("Unable to determine enabled cluster process: %s", err))
}
if !enabled {
config.DirectReadNs = stringargs{}
}
}
gtmBufferDuration, err := time.ParseDuration(config.GtmSettings.BufferDuration)
if err != nil {
Expand Down Expand Up @@ -3984,6 +3981,19 @@ func main() {
}
}
infoLog.Println("Listening for events")
if config.ClusterName != "" && !enabled {
gtmCtx.Pause()
bulk.Stop()
for range heartBeat.C {
enabled, err = enableProcess(mongo, config)
if enabled {
infoLog.Printf("Resuming work for cluster %s", config.ClusterName)
bulk.Start(context.Background())
resumeWork(gtmCtx, mongo, config)
break
}
}
}
for {
select {
case timeout := <-doneC:
Expand Down Expand Up @@ -4016,6 +4026,15 @@ func main() {
infoLog.Printf("Pausing work for cluster %s", config.ClusterName)
gtmCtx.Pause()
bulk.Stop()
for range heartBeat.C {
enabled, err = enableProcess(mongo, config)
if enabled {
infoLog.Printf("Resuming work for cluster %s", config.ClusterName)
bulk.Start(context.Background())
resumeWork(gtmCtx, mongo, config)
break
}
}
}
} else {
enabled, err = enableProcess(mongo, config)
Expand Down

0 comments on commit 039929b

Please sign in to comment.