Skip to content

Commit

Permalink
remove the spin loop (#60)
Browse files Browse the repository at this point in the history
I was going to build a more complex restart system that would recover from certain errors, but it's a lot more work so I'm skipping it for now.
  • Loading branch information
Southclaws authored Apr 7, 2020
1 parent 975266b commit 40a642e
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,20 +131,11 @@ func (app *App) Start(ctx context.Context) error {
}()
}

handle := func() error {
select {
case err := <-errs:
return err
case <-ctx.Done():
return context.Canceled
}
}

zap.L().Debug("starting service main loop")
for {
if err := handle(); err != nil {
return err
}
select {
case err := <-errs:
return err
case <-ctx.Done():
return context.Canceled
}
}

Expand Down

0 comments on commit 40a642e

Please sign in to comment.