shutdown: catch Drain() is not implemented

Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
This commit is contained in:
Adphi 2022-05-15 14:12:38 +02:00
parent e5a45801a1
commit 70913ba556
Signed by: adphi
GPG Key ID: 46BE4062DB2397FF

View File

@ -270,9 +270,14 @@ func (s *service) Stop() error {
sigs := s.notify() sigs := s.notify()
done := make(chan struct{}) done := make(chan struct{})
go func() { go func() {
defer close(done)
// TODO(adphi): find a better solution
defer func() {
// catch: Drain() is not implemented
recover()
}()
logrus.Warn("shutting down gracefully") logrus.Warn("shutting down gracefully")
s.server.GracefulStop() s.server.GracefulStop()
close(done)
}() }()
select { select {
case sig := <-sigs: case sig := <-sigs: