mirror of
https://codeberg.org/yeentown/barkey
synced 2024-12-22 18:50:00 +00:00
feat: queue force promote (#10370)
* feat: queue force promote * Update CHANGELOG.md * small fix
This commit is contained in:
parent
75888a55c3
commit
7331de0bce
6 changed files with 77 additions and 0 deletions
|
@ -34,6 +34,7 @@
|
|||
- APオブジェクトを入力してフェッチする機能とユーザーやノートの検索機能を分離
|
||||
- ナビゲーションバーの項目に「プロフィール」を追加できるように
|
||||
- ナビゲーションバーのカスタマイズをドラッグ&ドロップで行えるように
|
||||
- ジョブキューの再試行をワンクリックでできるように
|
||||
- AiScriptを0.13.1に更新
|
||||
- oEmbedをサポートしているウェブサイトのプレビューができるように
|
||||
- YouTubeをoEmbedでロードし、プレビューで共有ボタンを押すとOSの共有画面がでるように
|
||||
|
|
|
@ -978,6 +978,9 @@ license: "ライセンス"
|
|||
unfavoriteConfirm: "お気に入り解除しますか?"
|
||||
myClips: "自分のクリップ"
|
||||
drivecleaner: "ドライブクリーナー"
|
||||
retryAllQueuesNow: "すべてのキューを今すぐ再試行"
|
||||
retryAllQueuesConfirmTitle: "今すぐ再試行しますか?"
|
||||
retryAllQueuesConfirmText: "一時的にサーバーの負荷が増大することがあります。"
|
||||
|
||||
_achievements:
|
||||
earnedAt: "獲得日時"
|
||||
|
|
|
@ -42,6 +42,7 @@ import * as ep___admin_promo_create from './endpoints/admin/promo/create.js';
|
|||
import * as ep___admin_queue_clear from './endpoints/admin/queue/clear.js';
|
||||
import * as ep___admin_queue_deliverDelayed from './endpoints/admin/queue/deliver-delayed.js';
|
||||
import * as ep___admin_queue_inboxDelayed from './endpoints/admin/queue/inbox-delayed.js';
|
||||
import * as ep___admin_queue_promote from './endpoints/admin/queue/promote.js';
|
||||
import * as ep___admin_queue_stats from './endpoints/admin/queue/stats.js';
|
||||
import * as ep___admin_relays_add from './endpoints/admin/relays/add.js';
|
||||
import * as ep___admin_relays_list from './endpoints/admin/relays/list.js';
|
||||
|
@ -370,6 +371,7 @@ const $admin_promo_create: Provider = { provide: 'ep:admin/promo/create', useCla
|
|||
const $admin_queue_clear: Provider = { provide: 'ep:admin/queue/clear', useClass: ep___admin_queue_clear.default };
|
||||
const $admin_queue_deliverDelayed: Provider = { provide: 'ep:admin/queue/deliver-delayed', useClass: ep___admin_queue_deliverDelayed.default };
|
||||
const $admin_queue_inboxDelayed: Provider = { provide: 'ep:admin/queue/inbox-delayed', useClass: ep___admin_queue_inboxDelayed.default };
|
||||
const $admin_queue_promote: Provider = { provide: 'ep:admin/queue/promote', useClass: ep___admin_queue_promote.default };
|
||||
const $admin_queue_stats: Provider = { provide: 'ep:admin/queue/stats', useClass: ep___admin_queue_stats.default };
|
||||
const $admin_relays_add: Provider = { provide: 'ep:admin/relays/add', useClass: ep___admin_relays_add.default };
|
||||
const $admin_relays_list: Provider = { provide: 'ep:admin/relays/list', useClass: ep___admin_relays_list.default };
|
||||
|
@ -702,6 +704,7 @@ const $retention: Provider = { provide: 'ep:retention', useClass: ep___retention
|
|||
$admin_queue_clear,
|
||||
$admin_queue_deliverDelayed,
|
||||
$admin_queue_inboxDelayed,
|
||||
$admin_queue_promote,
|
||||
$admin_queue_stats,
|
||||
$admin_relays_add,
|
||||
$admin_relays_list,
|
||||
|
@ -1028,6 +1031,7 @@ const $retention: Provider = { provide: 'ep:retention', useClass: ep___retention
|
|||
$admin_queue_clear,
|
||||
$admin_queue_deliverDelayed,
|
||||
$admin_queue_inboxDelayed,
|
||||
$admin_queue_promote,
|
||||
$admin_queue_stats,
|
||||
$admin_relays_add,
|
||||
$admin_relays_list,
|
||||
|
|
|
@ -42,6 +42,7 @@ import * as ep___admin_promo_create from './endpoints/admin/promo/create.js';
|
|||
import * as ep___admin_queue_clear from './endpoints/admin/queue/clear.js';
|
||||
import * as ep___admin_queue_deliverDelayed from './endpoints/admin/queue/deliver-delayed.js';
|
||||
import * as ep___admin_queue_inboxDelayed from './endpoints/admin/queue/inbox-delayed.js';
|
||||
import * as ep___admin_queue_promote from './endpoints/admin/queue/promote.js';
|
||||
import * as ep___admin_queue_stats from './endpoints/admin/queue/stats.js';
|
||||
import * as ep___admin_relays_add from './endpoints/admin/relays/add.js';
|
||||
import * as ep___admin_relays_list from './endpoints/admin/relays/list.js';
|
||||
|
@ -368,6 +369,7 @@ const eps = [
|
|||
['admin/queue/clear', ep___admin_queue_clear],
|
||||
['admin/queue/deliver-delayed', ep___admin_queue_deliverDelayed],
|
||||
['admin/queue/inbox-delayed', ep___admin_queue_inboxDelayed],
|
||||
['admin/queue/promote', ep___admin_queue_promote],
|
||||
['admin/queue/stats', ep___admin_queue_stats],
|
||||
['admin/relays/add', ep___admin_relays_add],
|
||||
['admin/relays/list', ep___admin_relays_list],
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
import { Injectable } from '@nestjs/common';
|
||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||
import { ModerationLogService } from '@/core/ModerationLogService.js';
|
||||
import { QueueService } from '@/core/QueueService.js';
|
||||
|
||||
export const meta = {
|
||||
tags: ['admin'],
|
||||
|
||||
requireCredential: true,
|
||||
requireModerator: true,
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
type: { type: 'string', enum: ['deliver', 'inbox'] },
|
||||
},
|
||||
required: ['type'],
|
||||
} as const;
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
@Injectable()
|
||||
export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
constructor(
|
||||
private moderationLogService: ModerationLogService,
|
||||
private queueService: QueueService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
let delayedQueues;
|
||||
|
||||
switch (ps.type) {
|
||||
case 'deliver':
|
||||
delayedQueues = await this.queueService.deliverQueue.getDelayed();
|
||||
for (let queueIndex = 0; queueIndex < delayedQueues.length; queueIndex++) {
|
||||
const queue = delayedQueues[queueIndex];
|
||||
await queue.promote();
|
||||
}
|
||||
break;
|
||||
|
||||
case 'inbox':
|
||||
delayedQueues = await this.queueService.inboxQueue.getDelayed();
|
||||
for (let queueIndex = 0; queueIndex < delayedQueues.length; queueIndex++) {
|
||||
const queue = delayedQueues[queueIndex];
|
||||
await queue.promote();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
this.moderationLogService.insertModerationLog(me, 'promoteQueue');
|
||||
});
|
||||
}
|
||||
}
|
|
@ -4,6 +4,8 @@
|
|||
<MkSpacer :content-max="800">
|
||||
<XQueue v-if="tab === 'deliver'" domain="deliver"/>
|
||||
<XQueue v-else-if="tab === 'inbox'" domain="inbox"/>
|
||||
<br>
|
||||
<MkButton @click="promoteAllQueues"><i class="ti ti-reload"></i> {{ i18n.ts.retryAllQueuesNow }}</MkButton>
|
||||
</MkSpacer>
|
||||
</MkStickyContainer>
|
||||
</template>
|
||||
|
@ -15,6 +17,7 @@ import * as os from '@/os';
|
|||
import * as config from '@/config';
|
||||
import { i18n } from '@/i18n';
|
||||
import { definePageMetadata } from '@/scripts/page-metadata';
|
||||
import MkButton from '@/components/MkButton.vue';
|
||||
|
||||
let tab = $ref('deliver');
|
||||
|
||||
|
@ -30,6 +33,18 @@ function clear() {
|
|||
});
|
||||
}
|
||||
|
||||
function promoteAllQueues() {
|
||||
os.confirm({
|
||||
type: 'warning',
|
||||
title: i18n.ts.retryAllQueuesConfirmTitle,
|
||||
text: i18n.ts.retryAllQueuesConfirmText,
|
||||
}).then(({ canceled }) => {
|
||||
if (canceled) return;
|
||||
|
||||
os.apiWithDialog('admin/queue/promote', { type: tab });
|
||||
});
|
||||
}
|
||||
|
||||
const headerActions = $computed(() => [{
|
||||
asFullButton: true,
|
||||
icon: 'ti ti-external-link',
|
||||
|
|
Loading…
Reference in a new issue