Skip to content

Commit

Permalink
fix(BaseRedisBroker): proper import path to lua script (#8776)
Browse files Browse the repository at this point in the history
* fix(BaseRedisBroker): proper import path to lua script

* chore: fix tests

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
didinele and kodiakhq[bot] committed Oct 27, 2022
1 parent 53d8e87 commit e7cbc1b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions packages/brokers/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ import type Redis from 'ioredis';
import { test, expect, vi } from 'vitest';
import { PubSubRedisBroker } from '../src/index.js';

vi.mock('node:fs', () => {
return {
readFileSync: vi.fn(),
};
});

const mockRedisClient = {
defineCommand: vi.fn(),
xadd: vi.fn(),
Expand Down
2 changes: 1 addition & 1 deletion packages/brokers/src/brokers/redis/BaseRedis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export abstract class BaseRedisBroker<TEvents extends Record<string, any>>
this.options = { ...DefaultBrokerOptions, ...options };
options.redisClient.defineCommand('xcleangroup', {
numberOfKeys: 1,
lua: readFileSync(resolve(__dirname, '..', '..', '..', 'scripts', 'xcleangroup.lua'), 'utf8'),
lua: readFileSync(resolve(__dirname, '..', 'scripts', 'xcleangroup.lua'), 'utf8'),
});
this.streamReadClient = options.redisClient.duplicate();
}
Expand Down

0 comments on commit e7cbc1b

Please sign in to comment.