Improve chart performance (#7360)
* wip * wip * wip * wip * wip * Update chart.ts * wip * Improve server performance * wip * wip
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import * as Queue from 'bull';
|
||||
import * as httpSignature from 'http-signature';
|
||||
|
||||
import config from '../config';
|
||||
@@ -13,22 +12,7 @@ import { queueLogger } from './logger';
|
||||
import { DriveFile } from '../models/entities/drive-file';
|
||||
import { getJobInfo } from './get-job-info';
|
||||
import { IActivity } from '../remote/activitypub/type';
|
||||
|
||||
function initializeQueue(name: string, limitPerSec = -1) {
|
||||
return new Queue(name, {
|
||||
redis: {
|
||||
port: config.redis.port,
|
||||
host: config.redis.host,
|
||||
password: config.redis.pass,
|
||||
db: config.redis.db || 0,
|
||||
},
|
||||
prefix: config.redis.prefix ? `${config.redis.prefix}:queue` : 'queue',
|
||||
limiter: limitPerSec > 0 ? {
|
||||
max: limitPerSec * 5,
|
||||
duration: 5000
|
||||
} : undefined
|
||||
});
|
||||
}
|
||||
import { dbQueue, deliverQueue, inboxQueue, objectStorageQueue } from './queues';
|
||||
|
||||
export type InboxJobData = {
|
||||
activity: IActivity,
|
||||
@@ -44,11 +28,6 @@ function renderError(e: Error): any {
|
||||
};
|
||||
}
|
||||
|
||||
export const deliverQueue = initializeQueue('deliver', config.deliverJobPerSec || 128);
|
||||
export const inboxQueue = initializeQueue('inbox', config.inboxJobPerSec || 16);
|
||||
export const dbQueue = initializeQueue('db');
|
||||
export const objectStorageQueue = initializeQueue('objectStorage');
|
||||
|
||||
const deliverLogger = queueLogger.createSubLogger('deliver');
|
||||
const inboxLogger = queueLogger.createSubLogger('inbox');
|
||||
const dbLogger = queueLogger.createSubLogger('db');
|
||||
|
Reference in New Issue
Block a user