0
0
Fork 0

optimize: 何もしないユーザーはDB queryで引っ張らないように

This commit is contained in:
Xeltica 2021-01-06 02:24:35 +09:00
parent 09f4006326
commit 67ce80d7bd

View file

@ -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<AlertMode>('nothing'),
});
for (const user of users) {
try {
await send(user);