1
0
mirror of https://github.com/MisskeyIO/misskey synced 2024-11-23 22:56:49 +09:00

enhance(server): delete outdated notes of antenna regularly to improve db performance

This commit is contained in:
syuilo 2022-12-22 08:32:01 +09:00
parent ad4d8b07d3
commit a9a245b461
2 changed files with 9 additions and 1 deletions

View File

@ -27,6 +27,7 @@ You should also include the user name that made the change.
- Server: improve note scoring for featured notes @CyberRex0
- Server: delete outdated notifications regularly to improve db performance @syuilo
- Server: delete outdated hard-mutes regularly to improve db performance @syuilo
- Server: delete outdated notes of antenna 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

View File

@ -1,7 +1,7 @@
import { Inject, Injectable } from '@nestjs/common';
import { In, LessThan, MoreThan } from 'typeorm';
import { DI } from '@/di-symbols.js';
import type { MutedNotesRepository, NotificationsRepository, UserIpsRepository } from '@/models/index.js';
import type { AntennaNotesRepository, MutedNotesRepository, NotificationsRepository, UserIpsRepository } from '@/models/index.js';
import type { Config } from '@/config.js';
import type Logger from '@/logger.js';
import { bindThis } from '@/decorators.js';
@ -26,6 +26,9 @@ export class CleanProcessorService {
@Inject(DI.mutedNotesRepository)
private mutedNotesRepository: MutedNotesRepository,
@Inject(DI.antennaNotesRepository)
private antennaNotesRepository: AntennaNotesRepository,
private queueLoggerService: QueueLoggerService,
private idService: IdService,
) {
@ -49,6 +52,10 @@ export class CleanProcessorService {
reason: 'word',
});
this.antennaNotesRepository.delete({
id: LessThan(this.idService.genId(new Date(Date.now() - (1000 * 60 * 60 * 24 * 90)))),
});
this.logger.succ('Cleaned.');
done();
}