Skip to content

Commit

Permalink
Merge a0e7939 into a2d00ab
Browse files Browse the repository at this point in the history
  • Loading branch information
matomesc committed May 20, 2020
2 parents a2d00ab + a0e7939 commit 0ede6f6
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/RateLimiterPostgres.js
Expand Up @@ -152,17 +152,23 @@ class RateLimiterPostgres extends RateLimiterStoreAbstract {
}

set clientType(value) {
const constructorName = this.client.constructor.name;

if (typeof value === 'undefined') {
if (this.client.constructor.name === 'Client') {
if (constructorName === 'Client') {
value = 'client';
} else if (this.client.constructor.name === 'Pool') {
} else if (
constructorName === 'Pool' ||
constructorName === 'BoundPool'
) {
value = 'pool';
} else if (this.client.constructor.name === 'Sequelize') {
} else if (constructorName === 'Sequelize') {
value = 'sequelize';
} else {
throw new Error('storeType is not defined');
}
}

this._clientType = value.toLowerCase();
}

Expand Down

0 comments on commit 0ede6f6

Please sign in to comment.