fix: lint-backend (Magic number)

pull/4716/head
manx98 2025-05-26 22:56:57 +08:00
parent f801086b03
commit b251c541f5
1 changed files with 3 additions and 1 deletions

View File

@ -11,6 +11,8 @@ import (
"time" "time"
) )
const searchPingInterval = 5
var searchHandler = withUser(func(w http.ResponseWriter, r *http.Request, d *data) (int, error) { var searchHandler = withUser(func(w http.ResponseWriter, r *http.Request, d *data) (int, error) {
response := make(chan map[string]interface{}) response := make(chan map[string]interface{})
ctx, cancel := context.WithCancelCause(r.Context()) ctx, cancel := context.WithCancelCause(r.Context())
@ -19,7 +21,7 @@ var searchHandler = withUser(func(w http.ResponseWriter, r *http.Request, d *dat
go func() { go func() {
defer wg.Done() defer wg.Done()
// Avoid connection timeout // Avoid connection timeout
timeout := time.NewTimer(5 * time.Second) timeout := time.NewTimer(searchPingInterval * time.Second)
defer timeout.Stop() defer timeout.Stop()
for { for {
var err error var err error