diff --git a/main.go b/main.go index 14e2090..eb96e2b 100644 --- a/main.go +++ b/main.go @@ -703,10 +703,12 @@ func updateSummary(ctx context.Context, state *state, opts updateSummaryOptions) summary := result.Text() + state.dbMutex.Lock() _, err = state.db.ExecContext(ctx, "INSERT OR REPLACE INTO summaries (location, summary) VALUES (?, ?)", locKey, summary) if err != nil { slog.Warn("unable to cache generated weather summary to db", "location", locKey, "error", err) } + state.dbMutex.Unlock() state.summaries.Store(locKey, summary)