File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import (
2222 "io"
2323 "os/signal"
2424 "syscall"
25+ "time"
2526
2627 "github.com/spf13/cobra"
2728
@@ -111,7 +112,14 @@ func Run(rootCtx context.Context, rs *options.DeschedulerServer) error {
111112 if err != nil {
112113 klog .ErrorS (err , "failed to create tracer provider" )
113114 }
114- defer tracing .Shutdown (ctx )
115+ defer func () {
116+ // we give the tracing.Shutdown() its own context as the
117+ // original context may have been cancelled already. we
118+ // have arbitrarily chosen the timeout duration.
119+ ctx , cancel := context .WithTimeout (context .Background (), 3 * time .Second )
120+ defer cancel ()
121+ tracing .Shutdown (ctx )
122+ }()
115123
116124 // increase the fake watch channel so the dry-run mode can be run
117125 // over a cluster with thousands of pods
You can’t perform that action at this time.
0 commit comments