diff --git a/apps/api/src/categories/categories.service.ts b/apps/api/src/categories/categories.service.ts index ed6e206..9c1bea6 100644 --- a/apps/api/src/categories/categories.service.ts +++ b/apps/api/src/categories/categories.service.ts @@ -420,7 +420,11 @@ export class CategoriesService { // Build tree const tree = this.buildTree(dbCategories); - await this.redis.setJson(cacheKey, tree, 3600); + // Cache a populated tree for an hour; an EMPTY tree (transient decode/proxy + // failure) only for 60s so a blip doesn't poison the catalog for an hour — + // it self-heals on the next request after the source recovers, while still + // throttling re-decode attempts during a real outage. + await this.redis.setJson(cacheKey, tree, tree.length > 0 ? 3600 : 60); return tree; }