feat(cache,worker): overhaul cache layer and add generation task lease recovery
Deployment Config CI / Deployment Config (push) Successful in 24s
Backend CI / Backend (push) Successful in 14m33s

- shared/cache: add Options/L1/async/metrics/prefix decorators, multi-key ops, Redis pool tuning, and JSON readthrough metrics
- worker-generate: claim tasks via DB lease + heartbeat, requeue stale queued tasks, expire dead leases with refund/cache invalidation
- tenant: version article cache keys so worker recovery invalidations propagate cleanly
- shared/config: expand Redis (pool/timeouts/TLS) and Generation (lease/recovery) configs with defaults

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-03 02:02:39 +08:00
parent bbfeabdaa5
commit c1ef717d17
37 changed files with 2502 additions and 93 deletions
@@ -52,6 +52,9 @@ func HandleClaimedGenerationTaskFailure(
defer cancel()
errMsg := formatGenerationFailure("task_load", taskErr)
if taskErr != nil && strings.Contains(taskErr.Error(), "[worker_recovery]") {
errMsg = strings.TrimSpace(taskErr.Error())
}
now := time.Now()
auditRepo := repository.NewAuditRepository(pool)