Merge pull request #8 from bitechdev/copilot/sub-pr-5

Fix impossible type assertion in Remove method
This commit is contained in:
Hein Puth (Warkanum)
2025-12-30 14:04:08 +02:00
committed by GitHub

View File

@@ -220,8 +220,8 @@ func (sm *serverManager) Remove(name string) error {
// Stop the server if it's running. Prefer the server's configured shutdownTimeout
// when available, and fall back to a sensible default.
timeout := 10 * time.Second
if gs, ok := instance.(*gracefulServer); ok && gs.shutdownTimeout > 0 {
timeout = gs.shutdownTimeout
if si, ok := instance.(*serverInstance); ok && si.gracefulServer != nil && si.gracefulServer.shutdownTimeout > 0 {
timeout = si.gracefulServer.shutdownTimeout
}
ctx, cancel := context.WithTimeout(context.Background(), timeout)