Skip to content

Commit

Permalink
fix ctx
Browse files Browse the repository at this point in the history
  • Loading branch information
tonybase committed Mar 18, 2022
1 parent b9d98c0 commit 870cb88
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@ func (a *App) Run() error {
case <-ctx.Done():
return ctx.Err()
case <-c:
err := a.Stop()
if err != nil {
if err := a.Stop(); err != nil {
a.opts.logger.Errorf("failed to stop app: %v", err)
return err
}
Expand All @@ -139,7 +138,7 @@ func (a *App) Stop() error {
instance := a.instance
a.lk.Unlock()
if a.opts.registrar != nil && instance != nil {
ctx, cancel := context.WithTimeout(a.ctx, a.opts.registrarTimeout)
ctx, cancel := context.WithTimeout(NewContext(a.ctx, a), a.opts.registrarTimeout)
defer cancel()
if err := a.opts.registrar.Deregister(ctx, instance); err != nil {
return err
Expand Down

0 comments on commit 870cb88

Please sign in to comment.