Fix node-redis warning
node_redis: Deprecated: The SETEX command contains a argument of type Promise. This is converted to "[object Promise]" by using .toString() now and will return an error from v.3.0 on. Please handle this in your code to make sure everything works as you intended it to.
This commit is contained in:
parent
af00264e92
commit
ec5fa9ffcf
|
|
@ -46,7 +46,7 @@ module.exports = function(options = {}) {
|
|||
if (key) {
|
||||
const value = await redisClient.get(key);
|
||||
if (value) {
|
||||
let ttl = redisClient.ttl(key);
|
||||
let ttl = await redisClient.ttl(key);
|
||||
ttl = ttl > expire ? ttl : expire * 2;
|
||||
await redisClient.setex(key, ttl, value);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue