Release drops an OutcomeAcquired claim without recording a response. Use when the caller decided not to perform the side effect (e.g. the request failed validation before any external work happened), so the next caller with the same key can try again with a fresh payload rather than getting OutcomeM
(ctx context.Context, userID, key string)
| 267 | // Only deletes in_progress rows so it cannot accidentally wipe a |
| 268 | // completed cache entry. |
| 269 | func (s *Store) Release(ctx context.Context, userID, key string) error { |
| 270 | _, err := s.pool.Exec(ctx, |
| 271 | `DELETE FROM idempotency_keys |
| 272 | WHERE user_id = $1 AND key = $2 AND status = 'in_progress'`, |
| 273 | userID, key, |
| 274 | ) |
| 275 | return err |
| 276 | } |
| 277 | |
| 278 | // Sweep removes completed rows older than TTL. Returns the count |
| 279 | // deleted. Wire this into the cmd/e2a hourly cleanup loop. |