Skip to content

Commit

Permalink
fix: redis, connection issues and handle the error
Browse files Browse the repository at this point in the history
  • Loading branch information
anishshobithps committed May 8, 2024
1 parent 13d338b commit 470ee7e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/lib/redis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import IORedis, { RedisOptions } from 'ioredis';

const options: RedisOptions = {
maxRetriesPerRequest: null,
connectTimeout: 10000,
keepAlive: 1000,
tls: {
rejectUnauthorized: false,
}
Expand All @@ -11,4 +13,8 @@ export const connection = new IORedis(process.env.REDIS_KV!, options);

connection.once("connect", () => {
console.log('Connected to Redis');
});
});

connection.on("error", (error) => {
console.error('Redis error:', error);
});

0 comments on commit 470ee7e

Please sign in to comment.