space out system queue tasks to not crush the instance all at once
This commit is contained in:
parent
c5bbd667a7
commit
edcaef0727
3 changed files with 11 additions and 11 deletions
|
|
@ -80,7 +80,7 @@ export class QueueService implements OnModuleInit {
|
||||||
public async onModuleInit() {
|
public async onModuleInit() {
|
||||||
await this.systemQueue.upsertJobScheduler(
|
await this.systemQueue.upsertJobScheduler(
|
||||||
'tickCharts-scheduler',
|
'tickCharts-scheduler',
|
||||||
{ pattern: '55 * * * *' },
|
{ pattern: '0 * * * *' },
|
||||||
{
|
{
|
||||||
name: 'tickCharts',
|
name: 'tickCharts',
|
||||||
opts: {
|
opts: {
|
||||||
|
|
@ -91,7 +91,7 @@ export class QueueService implements OnModuleInit {
|
||||||
|
|
||||||
await this.systemQueue.upsertJobScheduler(
|
await this.systemQueue.upsertJobScheduler(
|
||||||
'resyncCharts-scheduler',
|
'resyncCharts-scheduler',
|
||||||
{ pattern: '0 0 * * *' },
|
{ pattern: '10 0 * * *' },
|
||||||
{
|
{
|
||||||
name: 'resyncCharts',
|
name: 'resyncCharts',
|
||||||
opts: {
|
opts: {
|
||||||
|
|
@ -102,7 +102,7 @@ export class QueueService implements OnModuleInit {
|
||||||
|
|
||||||
await this.systemQueue.upsertJobScheduler(
|
await this.systemQueue.upsertJobScheduler(
|
||||||
'cleanCharts-scheduler',
|
'cleanCharts-scheduler',
|
||||||
{ pattern: '0 0 * * *' },
|
{ pattern: '30 0 * * *' },
|
||||||
{
|
{
|
||||||
name: 'cleanCharts',
|
name: 'cleanCharts',
|
||||||
opts: {
|
opts: {
|
||||||
|
|
@ -113,7 +113,7 @@ export class QueueService implements OnModuleInit {
|
||||||
|
|
||||||
await this.systemQueue.upsertJobScheduler(
|
await this.systemQueue.upsertJobScheduler(
|
||||||
'aggregateRetention-scheduler',
|
'aggregateRetention-scheduler',
|
||||||
{ pattern: '0 0 * * *' },
|
{ pattern: '0 1 * * *' },
|
||||||
{
|
{
|
||||||
name: 'aggregateRetention',
|
name: 'aggregateRetention',
|
||||||
opts: {
|
opts: {
|
||||||
|
|
@ -124,7 +124,7 @@ export class QueueService implements OnModuleInit {
|
||||||
|
|
||||||
await this.systemQueue.upsertJobScheduler(
|
await this.systemQueue.upsertJobScheduler(
|
||||||
'clean-scheduler',
|
'clean-scheduler',
|
||||||
{ pattern: '0 0 * * *' },
|
{ pattern: '15 1 * * *' },
|
||||||
{
|
{
|
||||||
name: 'clean',
|
name: 'clean',
|
||||||
opts: {
|
opts: {
|
||||||
|
|
@ -146,7 +146,7 @@ export class QueueService implements OnModuleInit {
|
||||||
|
|
||||||
await this.systemQueue.upsertJobScheduler(
|
await this.systemQueue.upsertJobScheduler(
|
||||||
'backBufferedReactions-scheduler',
|
'backBufferedReactions-scheduler',
|
||||||
{ pattern: '0 0 * * *' },
|
{ pattern: '30 1 * * *' },
|
||||||
{
|
{
|
||||||
name: 'backBufferedReactions',
|
name: 'backBufferedReactions',
|
||||||
opts: {
|
opts: {
|
||||||
|
|
@ -158,7 +158,7 @@ export class QueueService implements OnModuleInit {
|
||||||
await this.systemQueue.upsertJobScheduler(
|
await this.systemQueue.upsertJobScheduler(
|
||||||
'checkModeratorsActivity-scheduler',
|
'checkModeratorsActivity-scheduler',
|
||||||
// 毎時30分に起動
|
// 毎時30分に起動
|
||||||
{ pattern: '30 * * * *' },
|
{ pattern: '45 1 * * *' },
|
||||||
{
|
{
|
||||||
name: 'checkModeratorsActivity',
|
name: 'checkModeratorsActivity',
|
||||||
opts: {
|
opts: {
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ export class AggregateRetentionProcessorService {
|
||||||
const data = deepClone(record.data);
|
const data = deepClone(record.data);
|
||||||
data[dateKey] = retention;
|
data[dateKey] = retention;
|
||||||
|
|
||||||
this.retentionAggregationsRepository.update(record.id, {
|
await this.retentionAggregationsRepository.update(record.id, {
|
||||||
updatedAt: now,
|
updatedAt: now,
|
||||||
data,
|
data,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -45,13 +45,13 @@ export class CleanProcessorService {
|
||||||
public async process(): Promise<void> {
|
public async process(): Promise<void> {
|
||||||
this.logger.info('Cleaning...');
|
this.logger.info('Cleaning...');
|
||||||
|
|
||||||
this.userIpsRepository.delete({
|
await this.userIpsRepository.delete({
|
||||||
createdAt: LessThan(new Date(this.timeService.now - (1000 * 60 * 60 * 24 * 90))),
|
createdAt: LessThan(new Date(this.timeService.now - (1000 * 60 * 60 * 24 * 90))),
|
||||||
});
|
});
|
||||||
|
|
||||||
// 使われてないアンテナを停止
|
// 使われてないアンテナを停止
|
||||||
if (this.config.deactivateAntennaThreshold > 0) {
|
if (this.config.deactivateAntennaThreshold > 0) {
|
||||||
this.antennasRepository.update({
|
await this.antennasRepository.update({
|
||||||
lastUsedAt: LessThan(new Date(this.timeService.now - this.config.deactivateAntennaThreshold)),
|
lastUsedAt: LessThan(new Date(this.timeService.now - this.config.deactivateAntennaThreshold)),
|
||||||
}, {
|
}, {
|
||||||
isActive: false,
|
isActive: false,
|
||||||
|
|
@ -69,7 +69,7 @@ export class CleanProcessorService {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.reversiService.cleanOutdatedGames();
|
await this.reversiService.cleanOutdatedGames();
|
||||||
|
|
||||||
this.logger.info('Cleaned.');
|
this.logger.info('Cleaned.');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue