chore(ws): increase timeouts

This commit is contained in:
Denis Gukov 2025-01-05 14:13:34 +05:00
parent 24cc613f1c
commit ad53a302bf
No known key found for this signature in database
GPG Key ID: 044381366A5D4731
2 changed files with 7 additions and 6 deletions

View File

@ -22,10 +22,10 @@ var upgrader = websocket.Upgrader{
const (
// Time allowed to write a message to the peer.
writeWait = 10 * time.Second
writeWait = 2 * 10 * time.Second
// Time allowed to read the next pong message from the peer.
pongWait = 60 * time.Second
pongWait = 2 * 60 * time.Second
// Send pings to peer with this period. Must be less than pongWait.
pingPeriod = (pongWait * 9) / 10
@ -45,15 +45,15 @@ func (c *connection) readPump() {
defer func() {
h.unregister <- c
_ = c.ws.Close()
//util.LogErrorWithFields(c.ws.Close(), log.Fields{"error": "Error closing websocket"})
//util.LogErrorF(c.ws.Close(), log.Fields{"error": "Error closing websocket"})
}()
c.ws.SetReadLimit(maxMessageSize)
//util.LogErrorWithFields(c.ws.SetReadDeadline(time.Now().Add(pongWait)), log.Fields{"error": "Socket state corrupt"})
//util.LogErrorF(c.ws.SetReadDeadline(time.Now().Add(pongWait)), log.Fields{"error": "Socket state corrupt"})
//
//c.ws.SetPongHandler(func(string) error {
// util.LogErrorWithFields(c.ws.SetReadDeadline(time.Now().Add(pongWait)), log.Fields{"error": "Socket state corrupt"})
// util.LogErrorF(c.ws.SetReadDeadline(time.Now().Add(pongWait)), log.Fields{"error": "Socket state corrupt"})
// return nil
//})

View File

@ -2,6 +2,7 @@ package db
import (
"encoding/json"
"errors"
"fmt"
"time"
@ -166,7 +167,7 @@ func (task *Task) ValidateNewTask(template Template) error {
func (task *TaskWithTpl) Fill(d Store) error {
if task.BuildTaskID != nil {
build, err := d.GetTask(task.ProjectID, *task.BuildTaskID)
if err == ErrNotFound {
if errors.Is(err, ErrNotFound) {
return nil
}
if err != nil {