From 09b9d3b3fa1dcd6df764c82050017f6fc42a129a Mon Sep 17 00:00:00 2001 From: Luis Pater Date: Fri, 29 Aug 2025 09:46:12 +0800 Subject: [PATCH] Unlock mutex before returning error in `handlers.go` to prevent deadlocks --- internal/api/handlers/handlers.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/api/handlers/handlers.go b/internal/api/handlers/handlers.go index 3f779431..8fe28ad7 100644 --- a/internal/api/handlers/handlers.go +++ b/internal/api/handlers/handlers.go @@ -109,6 +109,7 @@ func (h *BaseAPIHandler) GetClient(modelName string, isGenerateContent ...bool) } if len(clients) == 0 { + h.Mutex.Unlock() return nil, &interfaces.ErrorMessage{StatusCode: 500, Error: fmt.Errorf("no clients available")} }