Browse Source

:robot: Fixup echo shutdown

Ettore Di Giacinto 3 years ago
parent
commit
718e6156df
1 changed files with 3 additions and 2 deletions
  1. 3 2
      api/api.go

+ 3 - 2
api/api.go

@@ -264,8 +264,9 @@ func API(ctx context.Context, l string, defaultInterval, timeout time.Duration,
 
 	go func() {
 		<-ctx.Done()
-		ec.Shutdown(ctx)
-
+		ct, cancel := context.WithTimeout(context.Background(), 10*time.Second)
+		ec.Shutdown(ct)
+		cancel()
 	}()
 
 	return nil