storage: small fixes and sqlite3-specific tuning

This commit is contained in:
George Tankersley
2018-12-15 20:01:28 +00:00
parent 9a0639761b
commit 09007ad856
3 changed files with 13 additions and 14 deletions

View File

@@ -5,6 +5,7 @@ import (
"database/sql"
"encoding/hex"
"errors"
"fmt"
"time"
"github.com/golang/protobuf/proto"
@@ -25,7 +26,8 @@ type SqlStreamer struct {
}
func NewSQLiteStreamer(dbPath string) (rpc.CompactTxStreamerServer, error) {
db, err := sql.Open("sqlite3", dbPath)
db, err := sql.Open("sqlite3", fmt.Sprintf("file:%s?_busy_timeout=10000&cache=shared", dbPath))
db.SetMaxOpenConns(1)
if err != nil {
return nil, err
}