Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

fix(search): extend statement timeout to eight seconds (#8159)

Multica Eve7a9dc633d26b
diff --git a/server/internal/handler/search.go b/server/internal/handler/search.go
index bc695aaca1..c2c75350f1 100644
--- a/server/internal/handler/search.go
+++ b/server/internal/handler/search.go
@@ -25,16 +25,16 @@ import (
// therefore still make either path slow enough that the frontend appears to
// hang ("搜索卡死没有任何反应", MUL-4059).
//
-// The 5 s cap leaves headroom above the production-observed candidate-first
-// maximum (1.79 s in the MUL-7055 matrix) while keeping a bounded database
-// safety fuse. Interactive web callers cancel superseded searches, and the
-// mobile API client has a 30 s request timeout, so this remains within the
-// first-party clients' request budgets. On timeout the caller sees a 503 with
-// a descriptive error rather than a stalled connection — SearchIssues /
-// SearchProjects map SQLSTATE 57014 to http.StatusServiceUnavailable so the
-// frontend can distinguish this from a generic 500.
+// The 8 s cap adds three seconds of headroom above the MUL-7146 requests that
+// reached the previous 5 s database fuse, while remaining bounded well below
+// the mobile API client's 30 s request timeout. Interactive web callers cancel
+// superseded searches, limiting how long abandoned work can occupy a pooled
+// connection. On timeout the caller sees a 503 with a descriptive error rather
+// than a stalled connection — SearchIssues / SearchProjects map SQLSTATE 57014
+// to http.StatusServiceUnavailable so the frontend can distinguish this from a
+// generic 500.
const (
- searchStatementTimeout = 5 * time.Second
+ searchStatementTimeout = 8 * time.Second
searchWorkMemEnv = "DATABASE_SEARCH_WORK_MEM_MB"
defaultSearchWorkMemMB = 64