refactor(server): preserve cache-failure stack trace and reuse hasSearch

This commit is contained in:
Philipinho
2026-04-19 21:50:34 +01:00
parent cf6b48cd58
commit 7534b44e6e
2 changed files with 5 additions and 5 deletions
@@ -29,9 +29,8 @@ export class BaseQueryRouter {
const hasSearch = !!args.search; const hasSearch = !!args.search;
if (!hasFilter && !hasSorts && !hasSearch) return 'postgres'; if (!hasFilter && !hasSorts && !hasSearch) return 'postgres';
// v1: any search stays on Postgres. Trgm search also stays on Postgres // v1: any search stays on Postgres — loader doesn't populate search_text yet.
// until the loader populates `search_text`; re-evaluate after that lands. if (hasSearch) return 'postgres';
if (args.search) return 'postgres';
const count = await this.baseRowRepo.countActiveRows(args.baseId, { const count = await this.baseRowRepo.countActiveRows(args.baseId, {
workspaceId: args.workspaceId, workspaceId: args.workspaceId,
@@ -227,10 +227,11 @@ export class BaseRowService {
pagination, pagination,
}); });
} catch (err) { } catch (err) {
const error = err as Error;
this.logger.warn( this.logger.warn(
`Cache list failed for base ${dto.baseId}, falling back to Postgres`, `Cache list failed for base ${dto.baseId}, falling back to Postgres: ${error.message}`,
err as Error,
); );
if (error.stack) this.logger.warn(error.stack);
} }
} }