Skip to content

Commit

Permalink
if Redis is used, prefix channel name with ratelimit-
Browse files Browse the repository at this point in the history
  • Loading branch information
natesilva committed Oct 19, 2017
1 parent e3908ad commit 259b9b9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/storage/redisQuotaManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export class RedisQuotaManager extends QuotaManager {
private readonly uniqueId = uniqueId();
private readonly pubSubClient: RedisClient;
private readonly pingsReceived = new Map<string, number>();
private readonly channelName: string;
private _ready = false;
private heartbeatTimer: any = null;

Expand All @@ -20,11 +21,12 @@ export class RedisQuotaManager extends QuotaManager {
*/
constructor(
private readonly channelQuota: Quota,
private readonly channelName: string,
channelName: string,
private readonly client: RedisClient,
private readonly heartbeatInterval = 30000
) {
super({ interval: 1000, rate: 0, concurrency: 0 });
this.channelName = `ratelimit-${channelName}`;
this.pubSubClient = this.client.duplicate();
this.register();
}
Expand Down

0 comments on commit 259b9b9

Please sign in to comment.