use journal mode WAL for expand db use
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
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()
|
||||
_, err := db.Raw("PRAGMA wal_checkpoint(FULL)").Rows()
|
||||
if err != nil {
|
||||
logger.Error("Error checkpointing WAL: ", err.Error())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user