If startSession returned an error, run() returned immediately and the reaper + cdc poller goroutines kept running while defer store.Close() fired — a data race against the SQLite handle. Mirror the bottom-of-run shutdown sequence on the error path (cancel ctx, drain reaper, drain poller) so both goroutines have exited before the store is closed. The explicit-not-defer ordering is the same the existing post-srv.Run shutdown block uses; piling on more defers would hit the LIFO trap the same comment already warns about. Reported by Greptile on PR #52. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| internal | ||
| cdc_wiring.go | ||
| go.mod | ||
| go.sum | ||
| lifecycle_wiring.go | ||
| main.go | ||
| sqlc.yaml | ||
| wiring_test.go | ||