sqlite storage: Buffer write requests

This commit is contained in:
Matt Joiner 2020-11-14 22:57:19 +11:00
parent b0ebc856d9
commit 258585fd8b
1 changed files with 2 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import (
"bytes" "bytes"
"context" "context"
"errors" "errors"
"expvar"
"fmt" "fmt"
"io" "io"
"log" "log"
@ -258,7 +259,7 @@ func NewProvider(pool ConnPool, opts ProviderOpts) (_ *provider, err error) {
if err != nil { if err != nil {
return return
} }
writes := make(chan writeRequest) writes := make(chan writeRequest, 1<<(20-14))
prov := &provider{pool: pool, writes: writes, opts: opts} prov := &provider{pool: pool, writes: writes, opts: opts}
runtime.SetFinalizer(prov, func(p *provider) { runtime.SetFinalizer(prov, func(p *provider) {
// This is done in a finalizer, as it's easier than trying to synchronize on whether the // This is done in a finalizer, as it's easier than trying to synchronize on whether the