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 { deleteUser } from '../functions/users';
import { updateScore } from '../functions/update-score'; import { updateScore } from '../functions/update-score';
import { send } from './send'; import { send } from './send';
import { Not } from 'typeorm';
import { AlertMode } from '../types/AlertMode';
export default (): void => { export default (): void => {
cron.schedule('0 0 0 * * *', async () => { cron.schedule('0 0 0 * * *', async () => {
const users = await Users.createQueryBuilder() const users = await Users.find({
.select() alertMode: Not<AlertMode>('nothing'),
.getMany(); });
for (const user of users) { for (const user of users) {
try { try {
await send(user); await send(user);