feat: add additional redis settings to redis locker

* feat: add additional redis settings to redis locker

* fix: unfinished doc
This commit is contained in:
Arthur Joppart
2022-11-02 10:48:30 +01:00
committed by GitHub
parent ef48660b48
commit 79fa83a07a
2 changed files with 22 additions and 6 deletions

View File

@@ -103,7 +103,7 @@ jest.mock('ioredis', (): any => jest.fn().mockImplementation((): Redis => redis)
describe('A RedisLocker', (): void => {
it('will generate keys with the given namespacePrefix.', async(): Promise<void> => {
const identifier = { path: 'http://test.com/resource' };
const lockerPrefixed = new RedisLocker('6379', {}, 'MY_PREFIX');
const lockerPrefixed = new RedisLocker('6379', {}, { namespacePrefix: 'MY_PREFIX' });
await lockerPrefixed.acquire(identifier);
const allLocksPrefixed = Object.keys(store.internal).every((key): boolean => key.startsWith('MY_PREFIX'));
await lockerPrefixed.release(identifier);