fix: admin/queue/deliver-delayedとadmin/queue/inbox-delayedの応答速度を改善 (#17009)

This commit is contained in:
おさむのひと
2025-12-20 19:15:05 +09:00
committed by GitHub
parent 81bacb6203
commit f739cb6270
3 changed files with 9 additions and 14 deletions

View File

@@ -52,18 +52,14 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
super(meta, paramDef, async (ps, me) => {
const jobs = await this.deliverQueue.getJobs(['delayed']);
const res = [] as [string, number][];
const counts = new Map<string, number>();
for (const job of jobs) {
const host = new URL(job.data.to).host;
if (res.find(x => x[0] === host)) {
res.find(x => x[0] === host)![1]++;
} else {
res.push([host, 1]);
}
counts.set(host, (counts.get(host) ?? 0) + 1);
}
res.sort((a, b) => b[1] - a[1]);
const res = [...counts.entries()].sort((a, b) => b[1] - a[1]);
return res;
});

View File

@@ -52,18 +52,14 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
super(meta, paramDef, async (ps, me) => {
const jobs = await this.inboxQueue.getJobs(['delayed']);
const res = [] as [string, number][];
const counts = new Map<string, number>();
for (const job of jobs) {
const host = new URL(job.data.signature.keyId).host;
if (res.find(x => x[0] === host)) {
res.find(x => x[0] === host)![1]++;
} else {
res.push([host, 1]);
}
counts.set(host, (counts.get(host) ?? 0) + 1);
}
res.sort((a, b) => b[1] - a[1]);
const res = [...counts.entries()].sort((a, b) => b[1] - a[1]);
return res;
});