Fix nil context being passed to function
This commit is contained in:
parent
56e5d08eff
commit
a68f040ea6
|
@ -252,7 +252,7 @@ func NewPiecesStorage(opts NewPiecesStorageOpts) (_ storage.ClientImplCloser, er
|
|||
if opts.SetJournalMode == "" && !opts.Memory {
|
||||
opts.SetJournalMode = "wal"
|
||||
}
|
||||
err = initPoolConns(nil, conns, opts.InitConnOpts)
|
||||
err = initPoolConns(context.TODO(), conns, opts.InitConnOpts)
|
||||
if err != nil {
|
||||
conns.Close()
|
||||
return
|
||||
|
@ -494,7 +494,7 @@ type ConnPool interface {
|
|||
}
|
||||
|
||||
func withPoolConn(pool ConnPool, with func(conn)) {
|
||||
c := pool.Get(nil)
|
||||
c := pool.Get(context.TODO())
|
||||
defer pool.Put(c)
|
||||
with(c)
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ package sqliteStorage
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
|
@ -34,7 +35,7 @@ func newConnsAndProv(t *testing.T, opts NewPoolOpts) (ConnPool, *provider) {
|
|||
if !opts.Memory && opts.SetJournalMode == "" {
|
||||
opts.SetJournalMode = "wal"
|
||||
}
|
||||
qt.Assert(t, initPoolConns(nil, pool, opts.InitConnOpts), qt.IsNil)
|
||||
qt.Assert(t, initPoolConns(context.TODO(), pool, opts.InitConnOpts), qt.IsNil)
|
||||
prov, err := NewProvider(pool, ProviderOpts{BatchWrites: pool.NumConns() > 1})
|
||||
require.NoError(t, err)
|
||||
t.Cleanup(func() { prov.Close() })
|
||||
|
|
Loading…
Reference in New Issue