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;
if (!hasFilter && !hasSorts && !hasSearch) return 'postgres';
// v1: any search stays on Postgres. Trgm search also stays on Postgres
// until the loader populates `search_text`; re-evaluate after that lands.
if (args.search) return 'postgres';
// v1: any search stays on Postgres — loader doesn't populate search_text yet.
if (hasSearch) return 'postgres';
const count = await this.baseRowRepo.countActiveRows(args.baseId, {
workspaceId: args.workspaceId,
@@ -227,10 +227,11 @@ export class BaseRowService {
pagination,
});
} catch (err) {
const error = err as Error;
this.logger.warn(
`Cache list failed for base ${dto.baseId}, falling back to Postgres`,
err as Error,
`Cache list failed for base ${dto.baseId}, falling back to Postgres: ${error.message}`,
);
if (error.stack) this.logger.warn(error.stack);
}
}