diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8e1f1fae2..5d0287359 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -3657,7 +3657,7 @@ packages: resolution: {integrity: sha512-kcZ6+W5QzcJ3P1Mt+83OUv/oHFqZHIx8DuxG6eZ5RGMERoLqp4BuGjhHLYGK+Kf5XVkQvqBSmAy/nGWN3qDgEA==} engines: {node: '>=14'} peerDependencies: - typescript: '>=4.9.5' + typescript: 4.7.4 peerDependenciesMeta: typescript: optional: true @@ -6899,6 +6899,7 @@ packages: /node-gyp-build@4.6.1: resolution: {integrity: sha512-24vnklJmyRS8ViBNI8KbtK/r/DmXQMRiOMXTNz2nrTnAYUwjmEEbnnpB/+kt+yWRv73bPsSPRFddrcIbAxSiMQ==} hasBin: true + requiresBuild: true dev: false /node-int64@0.4.0: @@ -8708,7 +8709,7 @@ packages: '@types/jest': ^27.0.0 babel-jest: '>=27.0.0 <28' jest: ^27.0.0 - typescript: '>=3.8 <5.0' + typescript: 4.7.4 peerDependenciesMeta: '@babel/core': optional: true @@ -8740,7 +8741,7 @@ packages: engines: {node: ^14.13.1 || ^16 || >=18} hasBin: true peerDependencies: - typescript: ^4.3.5 || ^5.0.0 + typescript: 4.7.4 peerDependenciesMeta: typescript: optional: true @@ -8772,7 +8773,7 @@ packages: resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==} engines: {node: '>= 6'} peerDependencies: - typescript: '>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta' + typescript: 4.7.4 dependencies: tslib: 1.14.1 typescript: 4.7.4 @@ -9066,7 +9067,7 @@ packages: meow: ^9.0.0 optionator: ^0.9.1 stylelint: '>=13' - typescript: '*' + typescript: 4.7.4 vite: '>=2.0.0' vls: '*' vti: '*' diff --git a/src/adapters/fetcher/index.ts b/src/adapters/fetcher/index.ts index 9b656e08f..cb3627df0 100644 --- a/src/adapters/fetcher/index.ts +++ b/src/adapters/fetcher/index.ts @@ -7,11 +7,13 @@ import { attachAuthorization, convertToSnakeCase, makeLog } from "./utils" import toCurl from "fetch-to-curl" import { kafkaQueue } from "queue/kafka/queue" import { stack } from "utils/stack-trace" + import { CACHE_TTL_SECONDS, FETCH_TIMEOUT_SECONDS, REDIS_HOST, REDIS_DB, + REDIS_MASTER_NAME, TEST, } from "env" import { @@ -54,7 +56,14 @@ let cache = { if (!TEST) { logger.info("Connecting to Redis...") - const redis = new Redis(`redis://${REDIS_HOST}/${REDIS_DB}`) + + let redis = new Redis(`redis://${REDIS_HOST}/${REDIS_DB}`) + // add redis sentinel support + if (REDIS_MASTER_NAME != "") { + redis = new Redis(`redis://${REDIS_HOST}/${REDIS_DB}`, { + name: REDIS_MASTER_NAME, + }) + } redis .on("ready", () => { diff --git a/src/env.ts b/src/env.ts index 3f2f40b7f..3a70b13be 100644 --- a/src/env.ts +++ b/src/env.ts @@ -92,6 +92,7 @@ export const FETCH_TIMEOUT_SECONDS = process.env.FETCH_TIMEOUT_SECONDS || 5 export const CACHE_TTL_SECONDS = process.env.CACHE_TTL_SECONDS || 1800 export const REDIS_HOST = process.env.REDIS_HOST || "localhost:6379" export const REDIS_DB = process.env.REDIS_DB || "0" +export const REDIS_MASTER_NAME = process.env.REDIS_MASTER_NAME || "" export const MOCHI_GUESS_API_KEY = process.env.MOCHI_GUESS_API_KEY || "" export const MOCHI_GUESS_API_HOST = process.env.MOCHI_GUESS_API_HOST || ""