use a fresh spooldb session per image instead of a shared one

This commit is contained in:
Ian Gulliver
2026-05-31 19:33:48 -07:00
parent e70dce275c
commit f0809220e8
2 changed files with 54 additions and 61 deletions
+5 -4
View File
@@ -15,9 +15,10 @@ import (
//go:embed index.html
var indexHTML []byte
// serve runs the mobile putaway web server. Requests are serialized because the
// shared spooldb browser session is single-threaded.
func serve(addr string, auth claude.Auth, sp *spoolSync, dryRun bool) error {
// serve runs the mobile putaway web server. Each request gets its own fresh
// spooldb session; requests are serialized so we never run several headless
// browsers at once.
func serve(addr string, auth claude.Auth, dryRun bool) error {
var mu sync.Mutex
mux := http.NewServeMux()
@@ -53,7 +54,7 @@ func serve(addr string, auth claude.Auth, sp *spoolSync, dryRun bool) error {
start := time.Now()
mu.Lock()
res := processImg(img, hdr.Filename, auth, sp, dryRun)
res := processImg(img, hdr.Filename, auth, dryRun)
mu.Unlock()
slog.Info("processed upload", "file", hdr.Filename, "spool", res.SpoolID, "dur", time.Since(start))