enhance(server): delete outdated hard-mutes regularly to improve db performance
This commit is contained in:
parent
1fd9ba8dcb
commit
ad4d8b07d3
|
@ -26,6 +26,7 @@ You should also include the user name that made the change.
|
||||||
- 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
|
- Server: delete outdated notifications regularly to improve db performance @syuilo
|
||||||
|
- Server: delete outdated hard-mutes 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,10 +1,11 @@
|
||||||
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 { NotificationsRepository, UserIpsRepository } from '@/models/index.js';
|
import type { MutedNotesRepository, 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 { bindThis } from '@/decorators.js';
|
||||||
|
import { IdService } from '@/core/IdService.js';
|
||||||
import { QueueLoggerService } from '../QueueLoggerService.js';
|
import { QueueLoggerService } from '../QueueLoggerService.js';
|
||||||
import type Bull from 'bull';
|
import type Bull from 'bull';
|
||||||
|
|
||||||
|
@ -22,7 +23,11 @@ export class CleanProcessorService {
|
||||||
@Inject(DI.notificationsRepository)
|
@Inject(DI.notificationsRepository)
|
||||||
private notificationsRepository: NotificationsRepository,
|
private notificationsRepository: NotificationsRepository,
|
||||||
|
|
||||||
|
@Inject(DI.mutedNotesRepository)
|
||||||
|
private mutedNotesRepository: MutedNotesRepository,
|
||||||
|
|
||||||
private queueLoggerService: QueueLoggerService,
|
private queueLoggerService: QueueLoggerService,
|
||||||
|
private idService: IdService,
|
||||||
) {
|
) {
|
||||||
this.logger = this.queueLoggerService.logger.createSubLogger('clean');
|
this.logger = this.queueLoggerService.logger.createSubLogger('clean');
|
||||||
}
|
}
|
||||||
|
@ -39,6 +44,11 @@ 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.mutedNotesRepository.delete({
|
||||||
|
id: LessThan(this.idService.genId(new Date(Date.now() - (1000 * 60 * 60 * 24 * 90)))),
|
||||||
|
reason: 'word',
|
||||||
|
});
|
||||||
|
|
||||||
this.logger.succ('Cleaned.');
|
this.logger.succ('Cleaned.');
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue