mirror of
https://github.com/docmost/docmost.git
synced 2026-05-07 06:23:06 +08:00
refactor(server): preserve cache-failure stack trace and reuse hasSearch
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user