optimize: 何もしないユーザーはDB queryで引っ張らないように
This commit is contained in:
parent
09f4006326
commit
67ce80d7bd
1 changed files with 5 additions and 3 deletions
|
@ -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);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue