20 lines
421 B
Go
20 lines
421 B
Go
|
|
package cronjob
|
||
|
|
|
||
|
|
import (
|
||
|
|
"github.com/alireza0/s-ui/database"
|
||
|
|
"github.com/alireza0/s-ui/logger"
|
||
|
|
)
|
||
|
|
|
||
|
|
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())
|
||
|
|
}
|
||
|
|
}
|