Skip to content

Commit

Permalink
infinite for loop panics after hours. changed to infinite golang bool…
Browse files Browse the repository at this point in the history
… channel which is always return true.
  • Loading branch information
ahmetoz committed Apr 26, 2018
1 parent 3631239 commit 8b30423
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions prwatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,9 @@ func main() {
return cli.NewExitError("trigger_uri is required", 86)
}


infiniteChannel := make(chan bool)

token := basicAuth(c.String("username"), c.String("password"))
host := c.String("host")
project := c.String("project")
Expand All @@ -269,16 +272,13 @@ func main() {
}).Info("The PR watcher starting...")

triggerJob(host, project, repository, token, trigger_uri)

job := cron.New()
job.AddFunc(duration, func() {
triggerJob(host, project, repository, token, trigger_uri)
})
job.Start()

for true {

}
<-infiniteChannel

return nil
}
Expand Down

0 comments on commit 8b30423

Please sign in to comment.