mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-29 05:38:30 +01:00
管理画面のジョブキュー一覧の修正 (#5586)
* Fix: inboxのジョブキューが表示されない * ジョブキューで試行回数等を表示するように * DBとオブジェクトストレージのジョブキューが表示されるように
This commit is contained in:
parent
873444c3c6
commit
8ada1725bf
2 changed files with 25 additions and 12 deletions
|
@ -48,14 +48,15 @@
|
||||||
</ui-select>
|
</ui-select>
|
||||||
</ui-horizon-group>
|
</ui-horizon-group>
|
||||||
<sequential-entrance animation="entranceFromTop" delay="25">
|
<sequential-entrance animation="entranceFromTop" delay="25">
|
||||||
<div class="xvvuvgsv" v-for="job in jobs">
|
<div class="xvvuvgsv" v-for="job in jobs" :key="job.id">
|
||||||
<b>{{ job.id }}</b>
|
<b>{{ job.id }}</b>
|
||||||
<template v-if="domain === 'deliver'">
|
<template v-if="domain === 'deliver'">
|
||||||
<span>{{ job.data.to }}</span>
|
<span>{{ job.data.to }}</span>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="domain === 'inbox'">
|
<template v-if="domain === 'inbox'">
|
||||||
<span>{{ job.activity.id }}</span>
|
<span>{{ job.data.activity.id }}</span>
|
||||||
</template>
|
</template>
|
||||||
|
<span>{{ `(${job.attempts}/${job.maxAttempts}, ${Math.floor((jobsFetched - job.timestamp) / 1000 / 60)}min)` }}</span>
|
||||||
</div>
|
</div>
|
||||||
</sequential-entrance>
|
</sequential-entrance>
|
||||||
<ui-info v-if="jobs.length == jobsLimit">{{ $t('result-is-truncated', { n: jobsLimit }) }}</ui-info>
|
<ui-info v-if="jobs.length == jobsLimit">{{ $t('result-is-truncated', { n: jobsLimit }) }}</ui-info>
|
||||||
|
@ -84,6 +85,7 @@ export default Vue.extend({
|
||||||
chartLimit: 200,
|
chartLimit: 200,
|
||||||
jobs: [],
|
jobs: [],
|
||||||
jobsLimit: 50,
|
jobsLimit: 50,
|
||||||
|
jobsFetched: Date.now(),
|
||||||
domain: 'deliver',
|
domain: 'deliver',
|
||||||
state: 'delayed',
|
state: 'delayed',
|
||||||
faTasks, faPaperPlane, faInbox, faChartBar, faDatabase, faCloud
|
faTasks, faPaperPlane, faInbox, faChartBar, faDatabase, faCloud
|
||||||
|
@ -140,6 +142,7 @@ export default Vue.extend({
|
||||||
state: this.state,
|
state: this.state,
|
||||||
limit: this.jobsLimit
|
limit: this.jobsLimit
|
||||||
}).then(jobs => {
|
}).then(jobs => {
|
||||||
|
this.jobsFetched = Date.now(),
|
||||||
this.jobs = jobs;
|
this.jobs = jobs;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -149,7 +152,8 @@ export default Vue.extend({
|
||||||
|
|
||||||
<style lang="stylus" scoped>
|
<style lang="stylus" scoped>
|
||||||
.xvvuvgsv
|
.xvvuvgsv
|
||||||
> b
|
margin-left -6px
|
||||||
margin-right 16px
|
> b, span
|
||||||
|
margin 0 6px
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import $ from 'cafy';
|
import $ from 'cafy';
|
||||||
import define from '../../../define';
|
import define from '../../../define';
|
||||||
import { deliverQueue, inboxQueue } from '../../../../../queue';
|
import { deliverQueue, inboxQueue, dbQueue, objectStorageQueue } from '../../../../../queue';
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
tags: ['admin'],
|
tags: ['admin'],
|
||||||
|
@ -10,11 +10,11 @@ export const meta = {
|
||||||
|
|
||||||
params: {
|
params: {
|
||||||
domain: {
|
domain: {
|
||||||
validator: $.str,
|
validator: $.str.or(['deliver', 'inbox', 'db', 'objectStorage']),
|
||||||
},
|
},
|
||||||
|
|
||||||
state: {
|
state: {
|
||||||
validator: $.str,
|
validator: $.str.or(['active', 'waiting', 'delayed']),
|
||||||
},
|
},
|
||||||
|
|
||||||
limit: {
|
limit: {
|
||||||
|
@ -28,13 +28,22 @@ export default define(meta, async (ps) => {
|
||||||
const queue =
|
const queue =
|
||||||
ps.domain === 'deliver' ? deliverQueue :
|
ps.domain === 'deliver' ? deliverQueue :
|
||||||
ps.domain === 'inbox' ? inboxQueue :
|
ps.domain === 'inbox' ? inboxQueue :
|
||||||
|
ps.domain === 'db' ? dbQueue :
|
||||||
|
ps.domain === 'objectStorage' ? objectStorageQueue :
|
||||||
null as never;
|
null as never;
|
||||||
|
|
||||||
const jobs = await queue.getJobs([ps.state], 0, ps.limit!);
|
const jobs = await queue.getJobs([ps.state], 0, ps.limit!);
|
||||||
|
|
||||||
return jobs.map(job => ({
|
return jobs.map(job => {
|
||||||
id: job.id,
|
const data = job.data;
|
||||||
data: job.data,
|
delete data.content;
|
||||||
attempts: job.attemptsMade,
|
delete data.user;
|
||||||
}));
|
return {
|
||||||
|
id: job.id,
|
||||||
|
data,
|
||||||
|
attempts: job.attemptsMade,
|
||||||
|
maxAttempts: job.opts ? job.opts.attempts : 0,
|
||||||
|
timestamp: job.timestamp,
|
||||||
|
};
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue