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

@@ -73,7 +73,8 @@ func main() {
})
// Initialize database
db, err := sql.Open("sqlite3", opts.dbPath)
db, err := sql.Open("sqlite3", fmt.Sprintf("file:%s?_busy_timeout=10000&cache=shared", opts.dbPath))
db.SetMaxOpenConns(1)
if err != nil {
log.WithFields(logrus.Fields{
"db_path": opts.dbPath,
@@ -117,6 +118,7 @@ func main() {
}
connString := fmt.Sprintf("tcp://%s", opts.zmqAddr)
err = sock.Connect(connString)
if err != nil {
log.WithFields(logrus.Fields{
@@ -155,11 +157,6 @@ func main() {
switch string(topic) {
case opts.zmqTopic:
log.WithFields(logrus.Fields{
"seqnum": sequence,
"header": fmt.Sprintf("%x", body[:80]),
}).Debug("got block")
// there's an implicit mutex here
go handleBlock(db, sequence, body)