Support more rapid insertion; ignore issues with i/o

This commit is contained in:
DaneEveritt
2022-07-24 16:58:03 -04:00
parent 8cee18a92b
commit c18e844689
2 changed files with 8 additions and 2 deletions

View File

@@ -35,6 +35,12 @@ func Initialize() error {
sql.SetMaxOpenConns(1)
sql.SetConnMaxLifetime(time.Hour)
}
if tx := db.Exec("PRAGMA synchronous = OFF"); tx.Error != nil {
return errors.WithStack(tx.Error)
}
if tx := db.Exec("PRAGMA journal_mode = MEMORY"); tx.Error != nil {
return errors.WithStack(tx.Error)
}
if err := db.AutoMigrate(&models.Activity{}); err != nil {
return errors.WithStack(err)
}