Skip to content

Commit

Permalink
ジョブキューのlimitを表示するように
Browse files Browse the repository at this point in the history
  • Loading branch information
mei23 committed Apr 19, 2019
1 parent 9090061 commit 374d651
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/client/app/admin/views/queue.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<ui-input :value="latestStats.deliver.active | number" type="text" readonly>
<span>Active</span>
<template #prefix><fa :icon="farPlayCircle"/></template>
<template #suffix>jobs</template>
<template #suffix>{{ `/ ${latestStats.deliver.limit | number} jobs` }}</template>
</ui-input>
<ui-input :value="latestStats.deliver.waiting | number" type="text" readonly>
<span>Waiting</span>
Expand All @@ -39,7 +39,7 @@
<ui-input :value="latestStats.inbox.active | number" type="text" readonly>
<span>Active</span>
<template #prefix><fa :icon="farPlayCircle"/></template>
<template #suffix>jobs</template>
<template #suffix>{{ `/ ${latestStats.inbox.limit | number} jobs` }}</template>
</ui-input>
<ui-input :value="latestStats.inbox.waiting | number" type="text" readonly>
<span>Waiting</span>
Expand Down
4 changes: 2 additions & 2 deletions src/client/app/common/views/widgets/queue.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
<div class="mntrproz">
<div>
<b>In</b>
<span v-if="latestStats">{{ latestStats.inbox.active | number }} / {{ latestStats.inbox.waiting | number }}</span>
<span v-if="latestStats">{{ latestStats.inbox.active | number }} / {{ latestStats.inbox.limit | number }} ({{ latestStats.inbox.waiting | number }})</span>
<div ref="in"></div>
</div>
<div>
<b>Out</b>
<span v-if="latestStats">{{ latestStats.deliver.active | number }} / {{ latestStats.deliver.waiting | number }}</span>
<span v-if="latestStats">{{ latestStats.deliver.active | number }} / {{ latestStats.deliver.limit | number }} ({{ latestStats.deliver.waiting | number }})</span>
<div ref="out"></div>
</div>
</div>
Expand Down
10 changes: 10 additions & 0 deletions src/daemons/queue-stats.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
import * as Deque from 'double-ended-queue';
import Xev from 'xev';
import { deliverQueue, inboxQueue } from '../queue';
import { program } from './../argv';
import config from '../config';
import * as os from 'os';

const ev = new Xev();

const interval = 3000;

const workers = program.disableClustering ? 1 : Math.min(config.clusterLimit || Infinity, os.cpus().length);

const deliverConcurrencyPerWorker = config.deliverJobConcurrency || 32;
const inboxConcurrencyPerWorker = config.inboxJobConcurrency || 32;

/**
* Report queue stats regularly
*/
Expand Down Expand Up @@ -33,12 +41,14 @@ export default function() {

const stats = {
deliver: {
limit: deliverConcurrencyPerWorker * workers,
activeSincePrevTick: activeDeliverJobs,
active: deliverJobCounts.active,
waiting: deliverJobCounts.waiting,
delayed: deliverJobCounts.delayed
},
inbox: {
limit: inboxConcurrencyPerWorker * workers,
activeSincePrevTick: activeInboxJobs,
active: inboxJobCounts.active,
waiting: inboxJobCounts.waiting,
Expand Down

0 comments on commit 374d651

Please sign in to comment.