summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/api/stream/channels/queue-stats.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/backend/src/server/api/stream/channels/queue-stats.ts')
-rw-r--r--packages/backend/src/server/api/stream/channels/queue-stats.ts34
1 files changed, 10 insertions, 24 deletions
diff --git a/packages/backend/src/server/api/stream/channels/queue-stats.ts b/packages/backend/src/server/api/stream/channels/queue-stats.ts
index 91b62255b4..a87863f26c 100644
--- a/packages/backend/src/server/api/stream/channels/queue-stats.ts
+++ b/packages/backend/src/server/api/stream/channels/queue-stats.ts
@@ -4,21 +4,26 @@
*/
import Xev from 'xev';
-import { Injectable } from '@nestjs/common';
+import { Inject, Injectable, Scope } from '@nestjs/common';
import { bindThis } from '@/decorators.js';
import { isJsonObject } from '@/misc/json-value.js';
import type { JsonObject, JsonValue } from '@/misc/json-value.js';
-import Channel, { type MiChannelService } from '../channel.js';
+import Channel, { type ChannelRequest } from '../channel.js';
+import { REQUEST } from '@nestjs/core';
const ev = new Xev();
-class QueueStatsChannel extends Channel {
+@Injectable({ scope: Scope.TRANSIENT })
+export class QueueStatsChannel extends Channel {
public readonly chName = 'queueStats';
public static shouldShare = true;
public static requireCredential = false as const;
- constructor(id: string, connection: Channel['connection']) {
- super(id, connection);
+ constructor(
+ @Inject(REQUEST)
+ request: ChannelRequest,
+ ) {
+ super(request);
//this.onStats = this.onStats.bind(this);
//this.onMessage = this.onMessage.bind(this);
}
@@ -56,22 +61,3 @@ class QueueStatsChannel extends Channel {
ev.removeListener('queueStats', this.onStats);
}
}
-
-@Injectable()
-export class QueueStatsChannelService implements MiChannelService<false> {
- public readonly shouldShare = QueueStatsChannel.shouldShare;
- public readonly requireCredential = QueueStatsChannel.requireCredential;
- public readonly kind = QueueStatsChannel.kind;
-
- constructor(
- ) {
- }
-
- @bindThis
- public create(id: string, connection: Channel['connection']): QueueStatsChannel {
- return new QueueStatsChannel(
- id,
- connection,
- );
- }
-}