Fix tests
This commit is contained in:
parent
9c53cc52e9
commit
bc99f46720
@ -41,7 +41,7 @@ func NewApp(db *DBPool) *Application {
|
||||
Database: db,
|
||||
stopChan: make(chan bool),
|
||||
IsRunning: syncext.NewAtomicBool(false),
|
||||
RequestLogQueue: make(chan models.RequestLog, 1024),
|
||||
RequestLogQueue: make(chan models.RequestLog, 8192),
|
||||
MainDatabaseLock: golock.NewCASMutex(),
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ func (app *Application) DoRequest(gectx *ginext.AppContext, g *gin.Context, lock
|
||||
|
||||
t0 := time.Now()
|
||||
|
||||
for ctr := 1; ; ctr++ {
|
||||
for retryCtr := 1; ; retryCtr++ {
|
||||
|
||||
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 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")
|
||||
}
|
||||
|
||||
if ctr < maxRetry && isSqlite3Busy(wrap) {
|
||||
log.Warn().Int("counter", ctr).Str("url", g.Request.URL.String()).Msg("Retry request (ErrBusy)")
|
||||
if retryCtr < maxRetry && isSqlite3Busy(wrap) {
|
||||
log.Warn().Int("counter", retryCtr).Str("url", g.Request.URL.String()).Msg("Retry request (ErrBusy)")
|
||||
|
||||
err := resetBody(g)
|
||||
if err != nil {
|
||||
@ -105,14 +105,14 @@ func (app *Application) DoRequest(gectx *ginext.AppContext, g *gin.Context, lock
|
||||
|
||||
if reqctx.Err() == nil {
|
||||
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 {
|
||||
|
||||
statuscode := scw.Statuscode()
|
||||
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 {
|
||||
log.Warn().Str("url", g.Request.Method+"::"+g.Request.URL.String()).Msg(fmt.Sprintf("Request failed with statuscode [unknown]"))
|
||||
|
@ -254,6 +254,7 @@ func TestResponseChannelPreview(t *testing.T) {
|
||||
"internal_name": "string",
|
||||
"display_name": "string",
|
||||
"description_name": "string|null",
|
||||
"messages_sent": "int",
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user