11import HawkCatcher from '@hawk.so/nodejs' ;
22import { createClient , RedisClientType } from 'redis' ;
33
4+ // eslint call error: 0:0 error Parsing error: Cannot read properties of undefined (reading 'map')
5+ // export type TsRangeResult = [timestamp: string, value: string];
6+ export type TsRangeResult = any ;
7+
48/**
59 * Helper class for working with Redis
610 */
@@ -35,8 +39,10 @@ export default class RedisHelper {
3539 url : process . env . REDIS_URL ,
3640 socket : {
3741 reconnectStrategy : ( retries ) => {
38- // Exponential backoff: wait longer between each retry
39- // Max wait time: 30 seconds
42+ /*
43+ * Exponential backoff: wait longer between each retry
44+ * Max wait time: 30 seconds
45+ */
4046 const delay = Math . min ( retries * 1000 , 30000 ) ;
4147 console . log ( `[Redis] Reconnecting... attempt ${ retries } , waiting ${ delay } ms` ) ;
4248 return delay ;
@@ -132,7 +138,7 @@ export default class RedisHelper {
132138 end : string ,
133139 aggregationType : string ,
134140 bucketMs : string
135- ) : Promise < [ string , string ] [ ] > {
141+ ) : Promise < TsRangeResult [ ] > {
136142 return ( await this . redisClient . sendCommand ( [
137143 'TS.RANGE' ,
138144 key ,
@@ -141,6 +147,6 @@ export default class RedisHelper {
141147 'AGGREGATION' ,
142148 aggregationType ,
143149 bucketMs ,
144- ] ) ) as [ string , string ] [ ] ;
150+ ] ) ) as TsRangeResult [ ] ;
145151 }
146- }
152+ }
0 commit comments