forked from Ailur/burgernotes-server
Make the memory database actually in memory and not defer it so that it doesn't kill itself
This commit is contained in:
parent
9bd62dbf64
commit
d4148a4939
8
main.go
8
main.go
|
@ -288,16 +288,10 @@ func main() {
|
||||||
}
|
}
|
||||||
}(conn)
|
}(conn)
|
||||||
|
|
||||||
mem, err = sql.Open("sqlite3", ":memory: cache=shared")
|
mem, err = sql.Open("sqlite3", ":memory:?cache=shared&mode=memory")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalln("[FATAL] Cannot open session database:", err)
|
log.Fatalln("[FATAL] Cannot open session database:", err)
|
||||||
}
|
}
|
||||||
defer func(mem *sql.DB) {
|
|
||||||
err := mem.Close()
|
|
||||||
if err != nil {
|
|
||||||
log.Println("[ERROR] Unknown in main() mem defer:", err)
|
|
||||||
}
|
|
||||||
}(mem)
|
|
||||||
|
|
||||||
_, err = mem.Exec("CREATE TABLE sessions (sessionid INTEGER PRIMARY KEY AUTOINCREMENT, session TEXT NOT NULL, id INTEGER NOT NULL, device TEXT NOT NULL DEFAULT '?')")
|
_, err = mem.Exec("CREATE TABLE sessions (sessionid INTEGER PRIMARY KEY AUTOINCREMENT, session TEXT NOT NULL, id INTEGER NOT NULL, device TEXT NOT NULL DEFAULT '?')")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue