2026-05-10 06:41:44 +00:00
|
|
|
package cronjob
|
|
|
|
|
|
|
|
|
|
import (
|
2026-05-10 14:56:03 +08:00
|
|
|
"github.com/admin8800/s-ui/database"
|
|
|
|
|
"github.com/admin8800/s-ui/logger"
|
2026-05-10 06:41:44 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type WALCheckpointJob struct{}
|
|
|
|
|
|
|
|
|
|
func NewWALCheckpointJob() *WALCheckpointJob {
|
|
|
|
|
return &WALCheckpointJob{}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (s *WALCheckpointJob) Run() {
|
|
|
|
|
db := database.GetDB()
|
|
|
|
|
if err := db.Exec("PRAGMA wal_checkpoint(FULL)").Error; err != nil {
|
|
|
|
|
logger.Error("Error checkpointing WAL: ", err.Error())
|
|
|
|
|
}
|
|
|
|
|
}
|