node build fixed

This commit is contained in:
ra_ma
2025-09-20 14:08:38 +01:00
parent c6ebbe069d
commit 3d298fa434
1516 changed files with 535727 additions and 2 deletions

View File

@@ -0,0 +1,24 @@
package db
import (
"seanime/internal/database/models"
)
func (db *Database) TrimScanSummaryEntries() {
go func() {
var count int64
err := db.gormdb.Model(&models.ScanSummary{}).Count(&count).Error
if err != nil {
db.Logger.Error().Err(err).Msg("Failed to count scan summary entries")
return
}
if count > 10 {
// Leave 5 entries
err = db.gormdb.Delete(&models.ScanSummary{}, "id IN (SELECT id FROM scan_summaries ORDER BY id ASC LIMIT ?)", count-5).Error
if err != nil {
db.Logger.Error().Err(err).Msg("Failed to delete old scan summary entries")
return
}
}
}()
}