2
0
mirror of synced 2025-02-23 22:28:11 +00:00

Use NoSync with bolt storage and piece completion

Fixes terrible slowness on Linux.
This commit is contained in:
Matt Joiner 2018-01-09 23:11:34 +11:00
parent 6239a83bd6
commit 09218898e9
2 changed files with 9 additions and 7 deletions

View File

@ -35,6 +35,7 @@ func NewBoltPieceCompletion(dir string) (ret PieceCompletion, err error) {
if err != nil {
return
}
db.NoSync = true
ret = &boltPieceCompletion{db}
return
}

View File

@ -3,7 +3,9 @@ package storage
import (
"encoding/binary"
"path/filepath"
"time"
"github.com/anacrolix/missinggo/assert"
"github.com/boltdb/bolt"
"github.com/anacrolix/torrent/metainfo"
@ -25,13 +27,12 @@ type boltDBTorrent struct {
}
func NewBoltDB(filePath string) ClientImpl {
ret := &boltDBClient{}
var err error
ret.db, err = bolt.Open(filepath.Join(filePath, "bolt.db"), 0600, nil)
if err != nil {
panic(err)
}
return ret
db, err := bolt.Open(filepath.Join(filePath, "bolt.db"), 0600, &bolt.Options{
Timeout: time.Second,
})
assert.Nil(err)
db.NoSync = true
return &boltDBClient{db}
}
func (me *boltDBClient) Close() error {