Skip to content

Commit

Permalink
Remove promisify from redis client
Browse files Browse the repository at this point in the history
  • Loading branch information
dyedwiper committed Nov 26, 2024
1 parent de50d29 commit 44d6f33
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/utils/redis.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const { promisify } = require('util');
const Redis = require('ioredis');
const { Configuration } = require('@hpi-schul-cloud/commons');

Expand Down Expand Up @@ -32,19 +31,19 @@ function setRedisClient(client) {
}

const redisGetAsync = (...args) => {
if (redisClient) return promisify(redisClient.get).apply(redisClient, args);
if (redisClient) return redisClient.get(...args);
throw new GeneralError('No redis connection. Check for this via getRedisClient().');
};
const redisSetAsync = (...args) => {
if (redisClient) return promisify(redisClient.set).apply(redisClient, args);
if (redisClient) return redisClient.set(...args);
throw new GeneralError('No redis connection. Check for this via getRedisClient().');
};
const redisDelAsync = (...args) => {
if (redisClient) return promisify(redisClient.del).apply(redisClient, args);
if (redisClient) return redisClient.del(...args);
throw new GeneralError('No redis connection. Check for this via getRedisClient().');
};
const redisTtlAsync = (...args) => {
if (redisClient) return promisify(redisClient.ttl).apply(redisClient, args);
if (redisClient) return redisClient.ttl(...args);
throw new GeneralError('No redis connection. Check for this via getRedisClient().');
};

Expand Down

0 comments on commit 44d6f33

Please sign in to comment.