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

@ -22,8 +22,8 @@ export class StreamingApiServerService {
@Inject(DI.config)
private config: Config,
@Inject(DI.redisForPubsub)
private redisForPubsub: Redis.Redis,
@Inject(DI.redisForSub)
private redisForSub: Redis.Redis,
@Inject(DI.usersRepository)
private usersRepository: UsersRepository,
@ -81,7 +81,7 @@ export class StreamingApiServerService {
ev.emit(parsed.channel, parsed.message);
}
this.redisForPubsub.on('message', onRedisMessage);
this.redisForSub.on('message', onRedisMessage);
const main = new MainStreamConnection(
this.channelsService,
@ -111,7 +111,7 @@ export class StreamingApiServerService {
connection.once('close', () => {
ev.removeAllListeners();
main.dispose();
this.redisForPubsub.off('message', onRedisMessage);
this.redisForSub.off('message', onRedisMessage);
if (intervalId) clearInterval(intervalId);
});