mirror of
https://github.com/hotomoe/hotomoe
synced 2024-11-24 15:16:13 +09:00
enhance(server): delete outdated notifications regularly to improve db performance
This commit is contained in:
parent
689411c19a
commit
1fd9ba8dcb
@ -25,6 +25,7 @@ You should also include the user name that made the change.
|
|||||||
- Add Cloudflare Turnstile CAPTCHA support @CyberRex0
|
- Add Cloudflare Turnstile CAPTCHA support @CyberRex0
|
||||||
- Server: improve syslog performance @syuilo
|
- Server: improve syslog performance @syuilo
|
||||||
- Server: improve note scoring for featured notes @CyberRex0
|
- Server: improve note scoring for featured notes @CyberRex0
|
||||||
|
- Server: delete outdated notifications regularly to improve db performance @syuilo
|
||||||
- Client: use tabler-icons instead of fontawesome to better design @syuilo
|
- Client: use tabler-icons instead of fontawesome to better design @syuilo
|
||||||
- Client: Add new gabber kick sounds (thanks for noizenecio)
|
- Client: Add new gabber kick sounds (thanks for noizenecio)
|
||||||
- Client: Compress non-animated PNG files @saschanaz
|
- Client: Compress non-animated PNG files @saschanaz
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { In, LessThan, MoreThan } from 'typeorm';
|
import { In, LessThan, MoreThan } from 'typeorm';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import type { UserIpsRepository } from '@/models/index.js';
|
import type { NotificationsRepository, UserIpsRepository } from '@/models/index.js';
|
||||||
import type { Config } from '@/config.js';
|
import type { Config } from '@/config.js';
|
||||||
import type Logger from '@/logger.js';
|
import type Logger from '@/logger.js';
|
||||||
|
import { bindThis } from '@/decorators.js';
|
||||||
import { QueueLoggerService } from '../QueueLoggerService.js';
|
import { QueueLoggerService } from '../QueueLoggerService.js';
|
||||||
import type Bull from 'bull';
|
import type Bull from 'bull';
|
||||||
import { bindThis } from '@/decorators.js';
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class CleanProcessorService {
|
export class CleanProcessorService {
|
||||||
@ -19,6 +19,9 @@ export class CleanProcessorService {
|
|||||||
@Inject(DI.userIpsRepository)
|
@Inject(DI.userIpsRepository)
|
||||||
private userIpsRepository: UserIpsRepository,
|
private userIpsRepository: UserIpsRepository,
|
||||||
|
|
||||||
|
@Inject(DI.notificationsRepository)
|
||||||
|
private notificationsRepository: NotificationsRepository,
|
||||||
|
|
||||||
private queueLoggerService: QueueLoggerService,
|
private queueLoggerService: QueueLoggerService,
|
||||||
) {
|
) {
|
||||||
this.logger = this.queueLoggerService.logger.createSubLogger('clean');
|
this.logger = this.queueLoggerService.logger.createSubLogger('clean');
|
||||||
@ -32,6 +35,10 @@ export class CleanProcessorService {
|
|||||||
createdAt: LessThan(new Date(Date.now() - (1000 * 60 * 60 * 24 * 90))),
|
createdAt: LessThan(new Date(Date.now() - (1000 * 60 * 60 * 24 * 90))),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.notificationsRepository.delete({
|
||||||
|
createdAt: LessThan(new Date(Date.now() - (1000 * 60 * 60 * 24 * 90))),
|
||||||
|
});
|
||||||
|
|
||||||
this.logger.succ('Cleaned.');
|
this.logger.succ('Cleaned.');
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user