Lock thread to database, so it should not crash anymore.
This commit is contained in:
parent
102891c217
commit
def03ee25d
@ -14,6 +14,7 @@ import (
|
|||||||
//"database/sql"
|
//"database/sql"
|
||||||
"fmt"
|
"fmt"
|
||||||
"path"
|
"path"
|
||||||
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
// local
|
// local
|
||||||
@ -48,10 +49,12 @@ func (d *Database) Close() {
|
|||||||
tx.Commit()
|
tx.Commit()
|
||||||
|
|
||||||
d.Db.Close()
|
d.Db.Close()
|
||||||
|
runtime.UnlockOSThread()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Database) Initialize(cfg *configuration.Config) {
|
func (d *Database) Initialize(cfg *configuration.Config) {
|
||||||
fmt.Println("Initializing database...")
|
fmt.Println("Initializing database...")
|
||||||
|
runtime.LockOSThread()
|
||||||
|
|
||||||
// Connect to database.
|
// Connect to database.
|
||||||
db_path := path.Join(cfg.TEMP["DATA"], "database.sqlite3")
|
db_path := path.Join(cfg.TEMP["DATA"], "database.sqlite3")
|
||||||
|
Reference in New Issue
Block a user