1
0
mirror of https://github.com/pocketbase/pocketbase.git synced 2025-02-22 16:25:43 +02:00

[#5179] fixed days calculation for triggering old logs deletion

This commit is contained in:
Nehme Roumani 2024-07-06 12:50:21 +03:00 committed by GitHub
parent f1aa477378
commit 10ac417d96
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1261,7 +1261,7 @@ func (app *BaseApp) initLogger() error {
logsMaxDays := app.Settings().Logs.MaxDays
now := time.Now()
lastLogsDeletedAt := cast.ToTime(app.Store().Get("lastLogsDeletedAt"))
daysDiff := now.Sub(lastLogsDeletedAt).Hours() * 24
daysDiff := now.Sub(lastLogsDeletedAt).Hours() / 24
if daysDiff > float64(logsMaxDays) {
deleteErr := app.LogsDao().DeleteOldLogs(now.AddDate(0, 0, -1*logsMaxDays))
if deleteErr == nil {