File tree Expand file tree Collapse file tree 2 files changed +2
-42
lines changed
Expand file tree Collapse file tree 2 files changed +2
-42
lines changed Original file line number Diff line number Diff line change @@ -34,13 +34,11 @@ import {
3434 ILogger ,
3535 IMQMode ,
3636 EventMap ,
37- makeRedisSafe ,
3837 buildOptions ,
3938 profile ,
4039 uuid ,
4140} from '.' ;
4241import Redis from './redis' ;
43- import { logger } from '../test/mocks' ;
4442
4543const RX_CLIENT_NAME = / n a m e = ( \S + ) / g;
4644const RX_CLIENT_TEST = / : ( r e a d e r | w r i t e r | w a t c h e r ) / ;
@@ -806,12 +804,10 @@ export class RedisQueue extends EventEmitter<EventMap>
806804 enableReadyCheck : true ,
807805 enableOfflineQueue : true ,
808806 autoResendUnfulfilledCommands : true ,
807+ offlineQueue : true ,
809808 } ) ;
810809
811- context [ channel ] = makeRedisSafe (
812- redis ,
813- options . verbose ? options . logger : undefined ,
814- ) ;
810+ context [ channel ] = redis ;
815811 context [ channel ] . __imq = true ;
816812
817813 for ( const event of [
Original file line number Diff line number Diff line change 2323 */
2424/* tslint:disable */
2525import Redis from 'ioredis' ;
26- import { ILogger } from './IMessageQueue' ;
2726
2827/**
2928 * Extends default Redis type to allow dynamic properties access on it
@@ -35,40 +34,5 @@ export interface IRedisClient extends Redis {
3534 __imq ?: boolean ;
3635}
3736
38- // istanbul ignore next
39- export function makeRedisSafe (
40- redis : IRedisClient ,
41- logger ?: ILogger ,
42- ) : IRedisClient {
43- return new Proxy ( redis , {
44- get ( target , property , receiver ) {
45- const original = Reflect . get ( target , property , receiver ) ;
46-
47- if ( typeof original === 'function' ) {
48- return async ( ...args : unknown [ ] ) => {
49- try {
50- if ( target . status !== 'ready' ) {
51- logger ?. warn (
52- 'Redis client is not ready yet, while ' ,
53- `executing command: "${ String ( property ) } "` ,
54- ) ;
55-
56- return null ;
57- }
58-
59- return await original . apply ( target , args ) ;
60- } catch ( err : unknown ) {
61- logger ?. error ( err ) ;
62-
63- return null ;
64- }
65- } ;
66- }
67-
68- return original ;
69- } ,
70- } ) ;
71- }
72-
7337export { Redis } ;
7438export default Redis ;
You can’t perform that action at this time.
0 commit comments