forked from mirrors/misskey
refactor: use TRANSIENT scope to avoid service bucket relay (#16985)
* refactor: use TRANSIENT scope to avoid service bucket relay * lint: fix lints * refactor: use transient for apResolver * Update packages/backend/src/core/activitypub/models/ApImageService.ts * fix
This commit is contained in:
@@ -3,14 +3,16 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Inject, Injectable, Scope } from '@nestjs/common';
|
||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import type { GlobalEvents } from '@/core/GlobalEventService.js';
|
||||
import type { JsonObject } from '@/misc/json-value.js';
|
||||
import Channel, { type MiChannelService } from '../channel.js';
|
||||
import Channel, { type ChannelRequest } from '../channel.js';
|
||||
import { REQUEST } from '@nestjs/core';
|
||||
|
||||
class AntennaChannel extends Channel {
|
||||
@Injectable({ scope: Scope.TRANSIENT })
|
||||
export class AntennaChannel extends Channel {
|
||||
public readonly chName = 'antenna';
|
||||
public static shouldShare = false;
|
||||
public static requireCredential = true as const;
|
||||
@@ -18,12 +20,12 @@ class AntennaChannel extends Channel {
|
||||
private antennaId: string;
|
||||
|
||||
constructor(
|
||||
private noteEntityService: NoteEntityService,
|
||||
@Inject(REQUEST)
|
||||
request: ChannelRequest,
|
||||
|
||||
id: string,
|
||||
connection: Channel['connection'],
|
||||
private noteEntityService: NoteEntityService,
|
||||
) {
|
||||
super(id, connection);
|
||||
super(request);
|
||||
//this.onEvent = this.onEvent.bind(this);
|
||||
}
|
||||
|
||||
@@ -55,24 +57,3 @@ class AntennaChannel extends Channel {
|
||||
this.subscriber.off(`antennaStream:${this.antennaId}`, this.onEvent);
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class AntennaChannelService implements MiChannelService<true> {
|
||||
public readonly shouldShare = AntennaChannel.shouldShare;
|
||||
public readonly requireCredential = AntennaChannel.requireCredential;
|
||||
public readonly kind = AntennaChannel.kind;
|
||||
|
||||
constructor(
|
||||
private noteEntityService: NoteEntityService,
|
||||
) {
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public create(id: string, connection: Channel['connection']): AntennaChannel {
|
||||
return new AntennaChannel(
|
||||
this.noteEntityService,
|
||||
id,
|
||||
connection,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user