]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Fix sqlite storage for numconns 1
authorMatt Joiner <anacrolix@gmail.com>
Mon, 1 Feb 2021 04:47:28 +0000 (15:47 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Mon, 1 Feb 2021 23:41:39 +0000 (10:41 +1100)
storage/sqlite/sqlite-storage.go
test/transfer_test.go

index fb2bea4cd0c39d9495931bdbd3557e0b87fe0901..7fa7343bd4ba4240d4f934c974208cf779eabdc8 100644 (file)
@@ -265,9 +265,8 @@ func NewPool(opts NewPoolOpts) (_ ConnPool, _ ProviderOpts, err error) {
        }
        return conns, ProviderOpts{
                NumConns:              opts.NumConns,
-               NoConcurrentBlobReads: opts.NoConcurrentBlobReads || opts.Memory,
-               BatchWrites:           true,
-               //BatchWrites:           opts.NumConns > 1,
+               NoConcurrentBlobReads: opts.NoConcurrentBlobReads || opts.Memory || opts.NumConns == 1,
+               BatchWrites:           opts.NumConns > 1,
        }, nil
 }
 
index b014e9a32d5bb1a77b4b7f3a9369d63dd00dc762..47efef0bb3a90fefbbaff96324a9c48a8c09e8eb 100644 (file)
@@ -330,7 +330,7 @@ func TestClientTransferVarious(t *testing.T) {
                        Wrapper: fileCachePieceResourceStorage,
                }), 0},
                {"Boltdb", storage.NewBoltDB, 0},
-               //sqliteLeecherStorageTestCase(1),
+               sqliteLeecherStorageTestCase(1),
                sqliteLeecherStorageTestCase(2),
                // This should use a number of connections equal to the number of CPUs
                sqliteLeecherStorageTestCase(0),