Open SQLite with WAL and bound delivery re-dispatch by ownership (closes #256)
All checks were successful
check / check (push) Successful in 3m1s
All checks were successful
check / check (push) Successful in 3m1s
This commit was merged in pull request #263.
This commit is contained in:
@@ -92,11 +92,10 @@ func (h *Handlers) HandleEventBodyDownload() http.HandlerFunc {
|
||||
// once per range.
|
||||
//
|
||||
// One consequence is worth keeping in view: the read finishes
|
||||
// before the client is written to, so no read lock is held for
|
||||
// the length of a slow download. These per-webhook databases
|
||||
// run in SQLite's default journal mode rather than WAL, so a
|
||||
// lock held that long would block the receiver from recording
|
||||
// new events.
|
||||
// before the client is written to, so nothing is held open for
|
||||
// the length of a slow download. Under WAL a read no longer
|
||||
// blocks the receiver, but it does pin the WAL against
|
||||
// checkpointing, and a download can last minutes.
|
||||
func (h *Handlers) serveEventBody(
|
||||
w http.ResponseWriter,
|
||||
r *http.Request,
|
||||
|
||||
@@ -139,10 +139,10 @@ func (h *Handlers) resubmitEvent(
|
||||
}
|
||||
|
||||
// Read before the write transaction is opened. The body can be up
|
||||
// to the 1 MB ingest cap, and holding a read of it inside the
|
||||
// transaction would extend how long the per-webhook database is
|
||||
// locked against the receiver, which runs these files in
|
||||
// SQLite's default journal mode rather than WAL.
|
||||
// to the 1 MB ingest cap, and every transaction on these files
|
||||
// takes the write lock at BEGIN (_txlock=immediate, see
|
||||
// internal/database/sqlite_open.go), so reading inside it would
|
||||
// hold that lock against the receiver for the length of the read.
|
||||
src, found, err := loadResubmitSource(
|
||||
webhookDB, webhook.ID, eventID.String(),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user