Fix race in sqlite direct storage init
There's a race between starting the blob flusher and assigning the timer to the storage client.
This commit is contained in:
parent
88c0a85e44
commit
87294355fb
@ -58,6 +58,9 @@ func NewDirectStorage(opts NewDirectStorageOpts) (_ storage.ClientImplCloser, er
|
||||
blobs: make(map[string]*sqlite.Blob),
|
||||
opts: opts,
|
||||
}
|
||||
// Avoid race with cl.blobFlusherFunc
|
||||
cl.l.Lock()
|
||||
defer cl.l.Unlock()
|
||||
if opts.BlobFlushInterval != 0 {
|
||||
cl.blobFlusher = time.AfterFunc(opts.BlobFlushInterval, cl.blobFlusherFunc)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user