Describe the bug
In sidecar model, Kubernetes will send SIGTERM signals to all containers at the same time before destroying the pod, so dbpack container will stop at the same time as business containers, this may cause unpaid requests to fail.
I think DBPack should waiting for a length of time (terminationDrainDuration) before exiting can solve this problem. Just like Istio-Proxy does.
related code(cmd/cmd.go#L177)
`
dbpack.Start()
ctx, cancel := context.WithCancel(context.Background())
c := make(chan os.Signal, 2)
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
go func() {
<-c
cancel()
<-c
os.Exit(1) // second signal. Exit directly.
}()
<-ctx.Done()
`
Describe the bug
In sidecar model, Kubernetes will send SIGTERM signals to all containers at the same time before destroying the pod, so dbpack container will stop at the same time as business containers, this may cause unpaid requests to fail.
I think DBPack should waiting for a length of time (terminationDrainDuration) before exiting can solve this problem. Just like Istio-Proxy does.
related code(cmd/cmd.go#L177)
`
dbpack.Start()
`