Revert "fix test errors caused by AppLockService opening Redis connections in the constructor"

This reverts commit 04cd2e03c038cf1fb74869295c8ed3c32e20e3ee.
This commit is contained in:
Hazelnoot 2025-10-01 20:38:49 -04:00
parent b9cff02c54
commit 723ba56840

View file

@ -4,7 +4,7 @@
*/
import { promisify } from 'node:util';
import { Inject, Injectable, OnModuleInit } from '@nestjs/common';
import { Inject, Injectable } from '@nestjs/common';
import redisLock from 'redis-lock';
import * as Redis from 'ioredis';
import { DI } from '@/di-symbols.js';
@ -16,17 +16,13 @@ import { bindThis } from '@/decorators.js';
const retryDelay = 100;
@Injectable()
export class AppLockService implements OnModuleInit {
export class AppLockService {
private lock: (key: string, timeout?: number, _?: (() => Promise<void>) | undefined) => Promise<() => void>;
constructor(
@Inject(DI.redis)
private redisClient: Redis.Redis,
) {
}
@bindThis
async onModuleInit() {
this.lock = promisify(redisLock(this.redisClient, retryDelay));
}