mirror of
https://github.com/syncthing/syncthing.git
synced 2026-10-24 12:08:24 -04:00
1 parent
bf7d03d029
commit
e1b958284e
1 file changed
+7
-1
+7
-1
@@ -415,7 +415,13 @@ func (s *service) Serve(ctx context.Context) error {
|
||||
// Restart due to listen/serve failure
|
||||
l.Warnln("GUI/API:", err, "(restarting)")
|
||||
}
|
||||
srv.Close()
|
||||
// Give it a moment to shut down gracefully, e.g. if we are restarting
|
||||
// due to a config change through the API, let that finish successfully.
|
||||
timeout, cancel := context.WithTimeout(context.Background(), 100*time.Millisecond)
|
||||
defer cancel()
|
||||
if err := srv.Shutdown(timeout); err == timeout.Err() {
|
||||
srv.Close()
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user