Merge pull request '[FEAT] Don't log context cancelled SQL errors (squash)' (#2330) from gusted/forgejo-no-db into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2330 Reviewed-by: Otto <otto@codeberg.org>
This commit is contained in:
commit
91d40751c7
1 changed files with 2 additions and 1 deletions
|
@ -7,6 +7,7 @@ package db
|
|||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"reflect"
|
||||
|
@ -342,7 +343,7 @@ func (ErrorQueryHook) BeforeProcess(c *contexts.ContextHook) (context.Context, e
|
|||
}
|
||||
|
||||
func (h *ErrorQueryHook) AfterProcess(c *contexts.ContextHook) error {
|
||||
if c.Err != nil {
|
||||
if c.Err != nil && !errors.Is(c.Err, context.Canceled) {
|
||||
h.Logger.Log(8, log.ERROR, "[Error SQL Query] %s %v - %v", c.SQL, c.Args, c.Err)
|
||||
}
|
||||
return nil
|
||||
|
|
Loading…
Reference in a new issue