fix(backend): イベント用redis分離が上手く動かない問題を修正

This commit is contained in:
syuilo 2023-04-09 17:09:27 +09:00
parent b56f4b27ee
commit 39cf80e19f
9 changed files with 53 additions and 34 deletions

View file

@ -13,14 +13,14 @@ export class WebhookService implements OnApplicationShutdown {
private webhooks: Webhook[] = [];
constructor(
@Inject(DI.redisForPubsub)
private redisForPubsub: Redis.Redis,
@Inject(DI.redisForSub)
private redisForSub: Redis.Redis,
@Inject(DI.webhooksRepository)
private webhooksRepository: WebhooksRepository,
) {
//this.onMessage = this.onMessage.bind(this);
this.redisForPubsub.on('message', this.onMessage);
this.redisForSub.on('message', this.onMessage);
}
@bindThis
@ -82,6 +82,6 @@ export class WebhookService implements OnApplicationShutdown {
@bindThis
public onApplicationShutdown(signal?: string | undefined) {
this.redisForPubsub.off('message', this.onMessage);
this.redisForSub.off('message', this.onMessage);
}
}