Skip to content

Commit

Permalink
inboxLazyJobConcurrency
Browse files Browse the repository at this point in the history
  • Loading branch information
mei23 committed Sep 12, 2023
1 parent 8161bab commit 3e8c932
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions .config/example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ themeColor: '#fb4e4e'
# Job concurrency per worker (Default: deliver=cpu x 8, inbox=cpu x 1)
# deliverJobConcurrency: 128
# inboxJobConcurrency: 16
# inboxLazyJobConcurrency: 1

# Job late limiter (Default: nolimit, 変更しないことを推奨)
# deliverJobPerSec: 128
Expand Down
1 change: 1 addition & 0 deletions src/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export type Source = {

deliverJobConcurrency?: number;
inboxJobConcurrency?: number;
inboxLazyJobConcurrency?: number;
deliverJobPerSec?: number;
inboxJobPerSec?: number;
deliverJobMaxAttempts?: number;
Expand Down
4 changes: 2 additions & 2 deletions src/daemons/queue-stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Xev from 'xev';
import { deliverQueue, inboxQueue, inboxLazyQueue } from '../queue/queues';
import config from '../config';
import { getWorkerStrategies } from '..';
import { deliverJobConcurrency, inboxJobConcurrency } from '../queue';
import { deliverJobConcurrency, inboxJobConcurrency, inboxLazyJobConcurrency } from '../queue';

const ev = new Xev();

Expand Down Expand Up @@ -59,7 +59,7 @@ export default function() {
delayed: inboxJobCounts.delayed
},
inboxLazy: {
limit: 1 * workers,
limit: inboxLazyJobConcurrency * workers,
activeSincePrevTick: activeInboxLazyJobs,
active: inboxLazyJobCounts.active,
waiting: inboxLazyJobCounts.waiting,
Expand Down
3 changes: 2 additions & 1 deletion src/queue/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ let inboxDeltaCounts = 0;

export const deliverJobConcurrency = config.deliverJobConcurrency || ((cpus().length || 4) * 8);
export const inboxJobConcurrency = config.inboxJobConcurrency || ((cpus().length || 4) * 1);
export const inboxLazyJobConcurrency = config.inboxLazyJobConcurrency || 1;

deliverQueue
.on('waiting', (jobId) => {
Expand Down Expand Up @@ -368,7 +369,7 @@ export default function() {
deliverQueue.process(deliverJobConcurrency, processDeliver);
webpushDeliverQueue.process(8, processWebpushDeliver);
inboxQueue.process(inboxJobConcurrency, processInbox);
inboxLazyQueue.process(1, processInbox);
inboxLazyQueue.process(inboxLazyJobConcurrency, processInbox);
processDb(dbQueue);
}

Expand Down

0 comments on commit 3e8c932

Please sign in to comment.