diff --git a/src/client/app/admin/views/queue.vue b/src/client/app/admin/views/queue.vue
index fa9e3df780..ae3aa0db57 100644
--- a/src/client/app/admin/views/queue.vue
+++ b/src/client/app/admin/views/queue.vue
@@ -2,6 +2,34 @@
{{ $t('operation') }}
+
+
+
+
+ Waiting
+
+
+ Active
+
+
+ Delayed
+
+
+
+
+
+
+
+ Waiting
+
+
+ Active
+
+
+ Delayed
+
+
+
{{ $t('remove-all-jobs') }}
@@ -18,9 +46,16 @@ export default Vue.extend({
data() {
return {
+ stats: null
};
},
+ created() {
+ this.$root.api('admin/queue/stats').then(stats => {
+ this.stats = stats;
+ });
+ },
+
methods: {
async removeAllJobs() {
const process = async () => {
diff --git a/src/queue/index.ts b/src/queue/index.ts
index d5294f8367..93b103f5dc 100644
--- a/src/queue/index.ts
+++ b/src/queue/index.ts
@@ -21,9 +21,9 @@ function initializeQueue(name: string) {
} : null);
}
-const deliverQueue = initializeQueue('deliver');
-const inboxQueue = initializeQueue('inbox');
-const dbQueue = initializeQueue('db');
+export const deliverQueue = initializeQueue('deliver');
+export const inboxQueue = initializeQueue('inbox');
+export const dbQueue = initializeQueue('db');
export function deliver(user: ILocalUser, content: any, to: any) {
if (content == null) return null;
diff --git a/src/server/api/endpoints/admin/queue/stats.ts b/src/server/api/endpoints/admin/queue/stats.ts
new file mode 100644
index 0000000000..a90daa3989
--- /dev/null
+++ b/src/server/api/endpoints/admin/queue/stats.ts
@@ -0,0 +1,21 @@
+import define from '../../../define';
+import { deliverQueue } from '../../../../../queue';
+
+export const meta = {
+ tags: ['admin'],
+
+ requireCredential: true,
+ requireModerator: true,
+
+ params: {}
+};
+
+export default define(meta, async (ps) => {
+ const deliverJobCounts = await deliverQueue.getJobCounts();
+ const inboxJobCounts = await deliverQueue.getJobCounts();
+
+ return {
+ deliver: deliverJobCounts,
+ inbox: inboxJobCounts
+ };
+});