Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Start health-check server only after processor started successfully (#…
  • Loading branch information
sahare92 committed Feb 13, 2020
1 parent d9216ae commit 2b70b37
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions cmd/processor/app/processor.go
Expand Up @@ -171,15 +171,9 @@ func NewProcessor(configurationPath string, platformConfigurationPath string) (*
func (p *Processor) Start() error {
p.logger.DebugWith("Starting")

// start the web interface
err := p.healthCheckServer.Start()
if err != nil {
return errors.Wrap(err, "Failed to start health check server")
}

// iterate over all triggers and start them
for _, trigger := range p.triggers {
if err = trigger.Start(nil); err != nil {
if err := trigger.Start(nil); err != nil {
p.logger.ErrorWith("Failed to start trigger",
"kind", trigger.GetKind(),
"err", err.Error())
Expand All @@ -188,7 +182,7 @@ func (p *Processor) Start() error {
}

// start the web interface
err = p.webAdminServer.Start()
err := p.webAdminServer.Start()
if err != nil {
return errors.Wrap(err, "Failed to start web interface")
}
Expand All @@ -201,6 +195,13 @@ func (p *Processor) Start() error {
}
}

// start the health check server (starting after all the other servers)
// this server's successful response means that the processor is healthy and ready
err = p.healthCheckServer.Start()
if err != nil {
return errors.Wrap(err, "Failed to start health check server")
}

<-p.stop // Wait for stop
p.logger.Info("Processor quitting")

Expand Down

0 comments on commit 2b70b37

Please sign in to comment.