fix: lint-backend (Magic number)
parent
f801086b03
commit
b251c541f5
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue