feat(cache,worker): overhaul cache layer and add generation task lease recovery
- 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:
@@ -126,7 +126,18 @@ func New(configPath string) (*App, error) {
|
||||
cfg.RabbitMQ.DesktopDispatchMonitorPrefix + ".*.*",
|
||||
}
|
||||
desktopDispatch := stream.NewDesktopDispatchHub(mqClient, logger, desktopDispatchBindings)
|
||||
appCache := cache.New(cfg.Cache.Driver, rdb)
|
||||
appCache := cache.NewWithOptions(cfg.Cache.Driver, rdb, cache.Options{
|
||||
Namespace: cfg.Cache.Namespace,
|
||||
JitterRatio: cfg.Cache.JitterRatio,
|
||||
MetricsEnabled: cfg.Cache.MetricsEnabled,
|
||||
AsyncFillEnabled: cfg.Cache.AsyncFillEnabled,
|
||||
AsyncFillWorkers: cfg.Cache.AsyncFillWorkers,
|
||||
AsyncFillBuffer: cfg.Cache.AsyncFillBuffer,
|
||||
AsyncFillTimeout: cfg.Cache.AsyncFillTimeout,
|
||||
L1Enabled: cfg.Cache.L1Enabled,
|
||||
L1TTL: cfg.Cache.L1TTL,
|
||||
DeleteScanCount: cfg.Cache.DeleteScanCount,
|
||||
})
|
||||
brandService := tenantapp.NewBrandService(pool, monitoringPool, auditLogs, cfg.BrandLibrary).WithCache(appCache)
|
||||
monitoringService := tenantapp.NewMonitoringService(pool, monitoringPool, mqClient, cfg.MonitoringDispatch, cfg.BrandLibrary, logger).WithRedis(rdb)
|
||||
kolProfiles := repository.NewKolProfileRepository(pool)
|
||||
|
||||
Reference in New Issue
Block a user