Fix tests on CI (2)
This commit is contained in:
@@ -3,6 +3,7 @@ package logic
|
||||
import (
|
||||
scn "blackforestbytes.com/simplecloudnotifier"
|
||||
"blackforestbytes.com/simplecloudnotifier/db"
|
||||
ct "blackforestbytes.com/simplecloudnotifier/db/cursortoken"
|
||||
"blackforestbytes.com/simplecloudnotifier/db/simplectx"
|
||||
"blackforestbytes.com/simplecloudnotifier/google"
|
||||
"blackforestbytes.com/simplecloudnotifier/models"
|
||||
@@ -20,6 +21,7 @@ import (
|
||||
"os"
|
||||
"os/signal"
|
||||
"strings"
|
||||
"sync"
|
||||
"syscall"
|
||||
"time"
|
||||
)
|
||||
@@ -36,6 +38,7 @@ type Application struct {
|
||||
IsRunning *syncext.AtomicBool
|
||||
RequestLogQueue chan models.RequestLog
|
||||
MainDatabaseLock golock.RWMutex
|
||||
RequestDatabaseLock sync.Mutex
|
||||
keyTokenLastUsedDCI *dataext.SyncMap[models.KeyTokenID, *dataext.DelayedCombiningInvoker]
|
||||
}
|
||||
|
||||
@@ -46,6 +49,7 @@ func NewApp(db *DBPool) *Application {
|
||||
IsRunning: syncext.NewAtomicBool(false),
|
||||
RequestLogQueue: make(chan models.RequestLog, 8192),
|
||||
MainDatabaseLock: golock.NewCASMutex(),
|
||||
RequestDatabaseLock: sync.Mutex{},
|
||||
keyTokenLastUsedDCI: dataext.NewSyncMap[models.KeyTokenID, *dataext.DelayedCombiningInvoker](),
|
||||
}
|
||||
}
|
||||
@@ -353,3 +357,10 @@ func (app *Application) InsertRequestLog(data models.RequestLog) {
|
||||
log.Error().Msg("failed to insert request-log (queue full)")
|
||||
}
|
||||
}
|
||||
|
||||
func (app *Application) ListRequestLogs(ctx *simplectx.SimpleContext, filter models.RequestLogFilter, pageSize *int, start ct.CursorToken) ([]models.RequestLog, ct.CursorToken, error) {
|
||||
app.RequestDatabaseLock.Lock()
|
||||
defer app.RequestDatabaseLock.Unlock()
|
||||
|
||||
return app.Database.Requests.ListRequestLogs(ctx, filter, pageSize, start)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user