1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Server: Use slave database for reports

This commit is contained in:
Laurent Cozic 2024-05-13 14:51:19 +01:00
parent e9e6d8a69c
commit cd0ff94c0c
2 changed files with 2 additions and 1 deletions

View File

@ -33,7 +33,7 @@ router.get('admin/reports/:id', async (path: SubPath, ctx: AppContext) => {
if (reportType === ReportType.UserActivity) {
const query = parseQuery(ctx.query as Record<string, string>);
const changes = await userActivity(ctx.joplin.db, { interval: query.intervalHours * Hour });
const changes = await userActivity(ctx.joplin.dbSlave, { interval: query.intervalHours * Hour });
const models = ctx.joplin.models;
const users = await models.user().loadByIds(changes.map(c => c.user_id), { fields: ['id', 'email'] });

View File

@ -25,6 +25,7 @@ export interface NotificationView {
interface AppContextJoplin {
env: Env;
db: DbConnection;
dbSlave: DbConnection;
models: Models;
appLogger(): LoggerWrapper;
notifications: NotificationView[];