mirror of
https://github.com/hotomoe/hotomoe
synced 2024-11-28 06:48:21 +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
|
||||
- Server: improve syslog performance @syuilo
|
||||
- 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: Add new gabber kick sounds (thanks for noizenecio)
|
||||
- Client: Compress non-animated PNG files @saschanaz
|
||||
|
@ -1,12 +1,12 @@
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import { In, LessThan, MoreThan } from 'typeorm';
|
||||
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 Logger from '@/logger.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { QueueLoggerService } from '../QueueLoggerService.js';
|
||||
import type Bull from 'bull';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
|
||||
@Injectable()
|
||||
export class CleanProcessorService {
|
||||
@ -19,6 +19,9 @@ export class CleanProcessorService {
|
||||
@Inject(DI.userIpsRepository)
|
||||
private userIpsRepository: UserIpsRepository,
|
||||
|
||||
@Inject(DI.notificationsRepository)
|
||||
private notificationsRepository: NotificationsRepository,
|
||||
|
||||
private queueLoggerService: QueueLoggerService,
|
||||
) {
|
||||
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))),
|
||||
});
|
||||
|
||||
this.notificationsRepository.delete({
|
||||
createdAt: LessThan(new Date(Date.now() - (1000 * 60 * 60 * 24 * 90))),
|
||||
});
|
||||
|
||||
this.logger.succ('Cleaned.');
|
||||
done();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user