fix sql conflict on summary cache update

This commit is contained in:
2025-05-13 00:51:22 +01:00
parent 0549108114
commit a2a2d008dd

View File

@@ -703,7 +703,7 @@ func updateSummary(ctx context.Context, state *state, opts updateSummaryOptions)
summary := result.Text()
_, err = state.db.ExecContext(ctx, "INSERT INTO summaries (location, summary) VALUES (?, ?)", locKey, summary)
_, 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)
}