1
0
Эх сурвалжийг харах

Limit number of open db files (fixes #587)

Jakob Borg 11 жил өмнө
parent
commit
5235e82bda
1 өөрчлөгдсөн 2 нэмэгдсэн , 1 устгасан
  1. 2 1
      cmd/syncthing/main.go

+ 2 - 1
cmd/syncthing/main.go

@@ -38,6 +38,7 @@ import (
 	"github.com/syncthing/syncthing/upgrade"
 	"github.com/syncthing/syncthing/upnp"
 	"github.com/syndtr/goleveldb/leveldb"
+	"github.com/syndtr/goleveldb/leveldb/opt"
 )
 
 var (
@@ -398,7 +399,7 @@ func syncthingMain() {
 	// If this is the first time the user runs v0.9, archive the old indexes and config.
 	archiveLegacyConfig()
 
-	db, err := leveldb.OpenFile(filepath.Join(confDir, "index"), nil)
+	db, err := leveldb.OpenFile(filepath.Join(confDir, "index"), &opt.Options{MaxOpenFiles: 100})
 	if err != nil {
 		l.Fatalln("Cannot open database:", err, "- Is another copy of Syncthing already running?")
 	}