summaryrefslogtreecommitdiff
path: root/packages/backend/src/core
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2023-04-07 11:20:14 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2023-04-07 11:20:14 +0900
commitff6d9d28604d173b57bdb26b94ccd16bd0f4c4ba (patch)
tree7d608de794ce10af14f954d753ce2d86501ca5c7 /packages/backend/src/core
parentperf(backend): reduce db query (diff)
downloadsharkey-ff6d9d28604d173b57bdb26b94ccd16bd0f4c4ba.tar.gz
sharkey-ff6d9d28604d173b57bdb26b94ccd16bd0f4c4ba.tar.bz2
sharkey-ff6d9d28604d173b57bdb26b94ccd16bd0f4c4ba.zip
feat(backend): イベント用Redisを別サーバーに分離できるように
Diffstat (limited to 'packages/backend/src/core')
-rw-r--r--packages/backend/src/core/AntennaService.ts8
-rw-r--r--packages/backend/src/core/MetaService.ts8
-rw-r--r--packages/backend/src/core/RoleService.ts8
-rw-r--r--packages/backend/src/core/WebhookService.ts8
4 files changed, 16 insertions, 16 deletions
diff --git a/packages/backend/src/core/AntennaService.ts b/packages/backend/src/core/AntennaService.ts
index 4bd3f39af2..35266ac16d 100644
--- a/packages/backend/src/core/AntennaService.ts
+++ b/packages/backend/src/core/AntennaService.ts
@@ -27,8 +27,8 @@ export class AntennaService implements OnApplicationShutdown {
@Inject(DI.redis)
private redisClient: Redis.Redis,
- @Inject(DI.redisSubscriber)
- private redisSubscriber: Redis.Redis,
+ @Inject(DI.redisForPubsub)
+ private redisForPubsub: Redis.Redis,
@Inject(DI.mutingsRepository)
private mutingsRepository: MutingsRepository,
@@ -52,12 +52,12 @@ export class AntennaService implements OnApplicationShutdown {
this.antennasFetched = false;
this.antennas = [];
- this.redisSubscriber.on('message', this.onRedisMessage);
+ this.redisForPubsub.on('message', this.onRedisMessage);
}
@bindThis
public onApplicationShutdown(signal?: string | undefined) {
- this.redisSubscriber.off('message', this.onRedisMessage);
+ this.redisForPubsub.off('message', this.onRedisMessage);
}
@bindThis
diff --git a/packages/backend/src/core/MetaService.ts b/packages/backend/src/core/MetaService.ts
index 4b792c083d..2b6160c82e 100644
--- a/packages/backend/src/core/MetaService.ts
+++ b/packages/backend/src/core/MetaService.ts
@@ -14,8 +14,8 @@ export class MetaService implements OnApplicationShutdown {
private intervalId: NodeJS.Timer;
constructor(
- @Inject(DI.redisSubscriber)
- private redisSubscriber: Redis.Redis,
+ @Inject(DI.redisForPubsub)
+ private redisForPubsub: Redis.Redis,
@Inject(DI.db)
private db: DataSource,
@@ -33,7 +33,7 @@ export class MetaService implements OnApplicationShutdown {
}, 1000 * 60 * 5);
}
- this.redisSubscriber.on('message', this.onMessage);
+ this.redisForPubsub.on('message', this.onMessage);
}
@bindThis
@@ -122,6 +122,6 @@ export class MetaService implements OnApplicationShutdown {
@bindThis
public onApplicationShutdown(signal?: string | undefined) {
clearInterval(this.intervalId);
- this.redisSubscriber.off('message', this.onMessage);
+ this.redisForPubsub.off('message', this.onMessage);
}
}
diff --git a/packages/backend/src/core/RoleService.ts b/packages/backend/src/core/RoleService.ts
index 54e098ea52..3379f5af8b 100644
--- a/packages/backend/src/core/RoleService.ts
+++ b/packages/backend/src/core/RoleService.ts
@@ -64,8 +64,8 @@ export class RoleService implements OnApplicationShutdown {
public static NotAssignedError = class extends Error {};
constructor(
- @Inject(DI.redisSubscriber)
- private redisSubscriber: Redis.Redis,
+ @Inject(DI.redisForPubsub)
+ private redisForPubsub: Redis.Redis,
@Inject(DI.usersRepository)
private usersRepository: UsersRepository,
@@ -87,7 +87,7 @@ export class RoleService implements OnApplicationShutdown {
this.rolesCache = new MemorySingleCache<Role[]>(Infinity);
this.roleAssignmentByUserIdCache = new MemoryKVCache<RoleAssignment[]>(Infinity);
- this.redisSubscriber.on('message', this.onMessage);
+ this.redisForPubsub.on('message', this.onMessage);
}
@bindThis
@@ -400,6 +400,6 @@ export class RoleService implements OnApplicationShutdown {
@bindThis
public onApplicationShutdown(signal?: string | undefined) {
- this.redisSubscriber.off('message', this.onMessage);
+ this.redisForPubsub.off('message', this.onMessage);
}
}
diff --git a/packages/backend/src/core/WebhookService.ts b/packages/backend/src/core/WebhookService.ts
index ac1e413de6..85594f8557 100644
--- a/packages/backend/src/core/WebhookService.ts
+++ b/packages/backend/src/core/WebhookService.ts
@@ -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);
}
}