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
+7 -1
View File
@@ -85,7 +85,13 @@ func Diff(previous, current *Config) []FieldChange {
addChange("generation.worker", false)
}
if previous.Generation.StreamEnabled != current.Generation.StreamEnabled ||
previous.Generation.ArticleTimeout != current.Generation.ArticleTimeout {
previous.Generation.ArticleTimeout != current.Generation.ArticleTimeout ||
previous.Generation.TaskLeaseTTL != current.Generation.TaskLeaseTTL ||
previous.Generation.TaskRecoveryInterval != current.Generation.TaskRecoveryInterval ||
previous.Generation.TaskRecoveryTimeout != current.Generation.TaskRecoveryTimeout ||
previous.Generation.TaskRecoveryBatchSize != current.Generation.TaskRecoveryBatchSize ||
previous.Generation.TaskQueuedStaleAfter != current.Generation.TaskQueuedStaleAfter ||
previous.Generation.TaskMaxAttempts != current.Generation.TaskMaxAttempts {
addChange("generation", true)
}