Fix tests
Some checks failed
Build Docker and Deploy / Build Docker Container (push) Successful in 48s
Build Docker and Deploy / Run Unit-Tests (push) Failing after 9m44s
Build Docker and Deploy / Deploy to Server (push) Has been skipped

This commit is contained in:
Mike Schwörer 2025-04-12 20:55:37 +02:00
parent 9c53cc52e9
commit bc99f46720
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
3 changed files with 8 additions and 7 deletions

View File

@ -41,7 +41,7 @@ func NewApp(db *DBPool) *Application {
Database: db, Database: db,
stopChan: make(chan bool), stopChan: make(chan bool),
IsRunning: syncext.NewAtomicBool(false), IsRunning: syncext.NewAtomicBool(false),
RequestLogQueue: make(chan models.RequestLog, 1024), RequestLogQueue: make(chan models.RequestLog, 8192),
MainDatabaseLock: golock.NewCASMutex(), MainDatabaseLock: golock.NewCASMutex(),
} }
} }

View File

@ -33,7 +33,7 @@ func (app *Application) DoRequest(gectx *ginext.AppContext, g *gin.Context, lock
t0 := time.Now() t0 := time.Now()
for ctr := 1; ; ctr++ { for retryCtr := 1; ; retryCtr++ {
ictx, cancel := context.WithTimeout(gectx, app.Config.RequestTimeout) ictx, cancel := context.WithTimeout(gectx, app.Config.RequestTimeout)
@ -86,13 +86,13 @@ func (app *Application) DoRequest(gectx *ginext.AppContext, g *gin.Context, lock
if g.Writer.Written() { if g.Writer.Written() {
if scn.Conf.ReqLogEnabled { if scn.Conf.ReqLogEnabled {
app.InsertRequestLog(createRequestLog(g, t0, ctr, nil, langext.Ptr("Writing in WrapperFunc is not supported"))) app.InsertRequestLog(createRequestLog(g, t0, retryCtr, nil, langext.Ptr("Writing in WrapperFunc is not supported")))
} }
panic("Writing in WrapperFunc is not supported") panic("Writing in WrapperFunc is not supported")
} }
if ctr < maxRetry && isSqlite3Busy(wrap) { if retryCtr < maxRetry && isSqlite3Busy(wrap) {
log.Warn().Int("counter", ctr).Str("url", g.Request.URL.String()).Msg("Retry request (ErrBusy)") log.Warn().Int("counter", retryCtr).Str("url", g.Request.URL.String()).Msg("Retry request (ErrBusy)")
err := resetBody(g) err := resetBody(g)
if err != nil { if err != nil {
@ -105,14 +105,14 @@ func (app *Application) DoRequest(gectx *ginext.AppContext, g *gin.Context, lock
if reqctx.Err() == nil { if reqctx.Err() == nil {
if scn.Conf.ReqLogEnabled { if scn.Conf.ReqLogEnabled {
app.InsertRequestLog(createRequestLog(g, t0, ctr, wrap, nil)) app.InsertRequestLog(createRequestLog(g, t0, retryCtr, wrap, nil))
} }
if scw, ok := wrap.(ginext.InspectableHTTPResponse); ok { if scw, ok := wrap.(ginext.InspectableHTTPResponse); ok {
statuscode := scw.Statuscode() statuscode := scw.Statuscode()
if statuscode/100 != 2 { if statuscode/100 != 2 {
log.Warn().Str("url", g.Request.Method+"::"+g.Request.URL.String()).Msg(fmt.Sprintf("Request failed with statuscode %d", statuscode)) log.Warn().Str("url", g.Request.Method+"::"+g.Request.URL.String()).Msg(fmt.Sprintf("Request failed with statuscode %d (retries: %d) (isBusyErr: %v)", statuscode, retryCtr, isSqlite3Busy(wrap)))
} }
} else { } else {
log.Warn().Str("url", g.Request.Method+"::"+g.Request.URL.String()).Msg(fmt.Sprintf("Request failed with statuscode [unknown]")) log.Warn().Str("url", g.Request.Method+"::"+g.Request.URL.String()).Msg(fmt.Sprintf("Request failed with statuscode [unknown]"))

View File

@ -254,6 +254,7 @@ func TestResponseChannelPreview(t *testing.T) {
"internal_name": "string", "internal_name": "string",
"display_name": "string", "display_name": "string",
"description_name": "string|null", "description_name": "string|null",
"messages_sent": "int",
}) })
} }