refactor(redis): ♻️ Restructure RedisPublisherService and RedisSessionService for cleaner organization and improved maintainability
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
487eeaad87
commit
48332edaa2
2 changed files with 4 additions and 0 deletions
|
|
@ -30,10 +30,12 @@ export class RedisPublisherService implements OnModuleInit, OnModuleDestroy {
|
|||
async onModuleInit() {
|
||||
const host = this.config.get('REDIS_HOST', 'localhost');
|
||||
const port = this.config.get('REDIS_PORT', 6379);
|
||||
const password = this.config.get<string>('REDIS_PASSWORD');
|
||||
|
||||
this.publisher = new Redis({
|
||||
host,
|
||||
port,
|
||||
...(password ? { password } : {}),
|
||||
retryStrategy: (times) => {
|
||||
const delay = Math.min(times * 50, 2000);
|
||||
return delay;
|
||||
|
|
|
|||
|
|
@ -38,10 +38,12 @@ export class RedisSessionService implements OnModuleInit, OnModuleDestroy {
|
|||
async onModuleInit() {
|
||||
const host = this.config.get('REDIS_HOST', 'localhost');
|
||||
const port = this.config.get('REDIS_PORT', 6379);
|
||||
const password = this.config.get<string>('REDIS_PASSWORD');
|
||||
|
||||
this.redis = new Redis({
|
||||
host,
|
||||
port,
|
||||
...(password ? { password } : {}),
|
||||
retryStrategy: (times) => {
|
||||
const delay = Math.min(times * 50, 2000);
|
||||
return delay;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue