From 67ce80d7bd502bef8cbf2c482bece5387777986b Mon Sep 17 00:00:00 2001 From: Xeltica Date: Wed, 6 Jan 2021 02:24:35 +0900 Subject: [PATCH] =?UTF-8?q?optimize:=20=E4=BD=95=E3=82=82=E3=81=97?= =?UTF-8?q?=E3=81=AA=E3=81=84=E3=83=A6=E3=83=BC=E3=82=B6=E3=83=BC=E3=81=AF?= =?UTF-8?q?DB=20query=E3=81=A7=E5=BC=95=E3=81=A3=E5=BC=B5=E3=82=89?= =?UTF-8?q?=E3=81=AA=E3=81=84=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/services/worker.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/services/worker.ts b/src/services/worker.ts index d6fcdf1..b165759 100644 --- a/src/services/worker.ts +++ b/src/services/worker.ts @@ -5,12 +5,14 @@ import { Users } from '../models'; import { deleteUser } from '../functions/users'; import { updateScore } from '../functions/update-score'; import { send } from './send'; +import { Not } from 'typeorm'; +import { AlertMode } from '../types/AlertMode'; export default (): void => { cron.schedule('0 0 0 * * *', async () => { - const users = await Users.createQueryBuilder() - .select() - .getMany(); + const users = await Users.find({ + alertMode: Not('nothing'), + }); for (const user of users) { try { await send(user);