Revert "fix test errors caused by AppLockService opening Redis connections in the constructor"
This reverts commit 04cd2e03c038cf1fb74869295c8ed3c32e20e3ee.
This commit is contained in:
parent
b9cff02c54
commit
723ba56840
1 changed files with 2 additions and 6 deletions
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue