Lock thread to database, so it should not crash anymore.

This commit is contained in:
Stanislav Nikitin 2016-10-07 14:57:01 +05:00
parent 102891c217
commit def03ee25d
1 changed files with 3 additions and 0 deletions

View File

@ -14,6 +14,7 @@ import (
//"database/sql"
"fmt"
"path"
"runtime"
"strconv"
// local
@ -48,10 +49,12 @@ func (d *Database) Close() {
tx.Commit()
d.Db.Close()
runtime.UnlockOSThread()
}
func (d *Database) Initialize(cfg *configuration.Config) {
fmt.Println("Initializing database...")
runtime.LockOSThread()
// Connect to database.
db_path := path.Join(cfg.TEMP["DATA"], "database.sqlite3")