Use NoSync with bolt storage and piece completion
Fixes terrible slowness on Linux.
This commit is contained in:
parent
6239a83bd6
commit
09218898e9
@ -35,6 +35,7 @@ func NewBoltPieceCompletion(dir string) (ret PieceCompletion, err error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
db.NoSync = true
|
||||||
ret = &boltPieceCompletion{db}
|
ret = &boltPieceCompletion{db}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,9 @@ package storage
|
|||||||
import (
|
import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/anacrolix/missinggo/assert"
|
||||||
"github.com/boltdb/bolt"
|
"github.com/boltdb/bolt"
|
||||||
|
|
||||||
"github.com/anacrolix/torrent/metainfo"
|
"github.com/anacrolix/torrent/metainfo"
|
||||||
@ -25,13 +27,12 @@ type boltDBTorrent struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewBoltDB(filePath string) ClientImpl {
|
func NewBoltDB(filePath string) ClientImpl {
|
||||||
ret := &boltDBClient{}
|
db, err := bolt.Open(filepath.Join(filePath, "bolt.db"), 0600, &bolt.Options{
|
||||||
var err error
|
Timeout: time.Second,
|
||||||
ret.db, err = bolt.Open(filepath.Join(filePath, "bolt.db"), 0600, nil)
|
})
|
||||||
if err != nil {
|
assert.Nil(err)
|
||||||
panic(err)
|
db.NoSync = true
|
||||||
}
|
return &boltDBClient{db}
|
||||||
return ret
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (me *boltDBClient) Close() error {
|
func (me *boltDBClient) Close() error {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user