feat: move from upstash to redis
Some checks failed
Deploy / lint-build-deploy (push) Failing after 2m35s
Some checks failed
Deploy / lint-build-deploy (push) Failing after 2m35s
This commit is contained in:
@@ -1,18 +1,11 @@
|
||||
import { Redis } from '@upstash/redis';
|
||||
import Redis from 'ioredis';
|
||||
|
||||
if (!process.env.KV_REST_API_URL) {
|
||||
throw new Error('KV_REST_API_URL is not defined');
|
||||
}
|
||||
|
||||
if (!process.env.KV_REST_API_TOKEN) {
|
||||
throw new Error('KV_REST_API_TOKEN is not defined');
|
||||
}
|
||||
const redisHost = process.env.REDIS_HOST || 'localhost';
|
||||
const redisPort = parseInt(process.env.REDIS_PORT || '6379', 10);
|
||||
|
||||
export const redis = new Redis({
|
||||
url: process.env.KV_REST_API_URL,
|
||||
token: process.env.KV_REST_API_TOKEN,
|
||||
retry: {
|
||||
retries: 3,
|
||||
backoff: (retryCount) => Math.min(retryCount * 100, 3000),
|
||||
},
|
||||
host: redisHost,
|
||||
port: redisPort,
|
||||
maxRetriesPerRequest: 3,
|
||||
retryStrategy: (times) => Math.min(times * 100, 3000),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user