feat(backend): イベント用Redisを別サーバーに分離できるように

This commit is contained in:
syuilo 2023-04-07 11:20:14 +09:00
parent f4588f3907
commit ff6d9d2860
15 changed files with 98 additions and 51 deletions

View file

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