feat: make ioredis configurable via environment variables (#3365)

* feat: expose ioredis client options

* run linter

* refactor redis client init into class extension

* explicitly handle constructor errors

* rename singletons
This commit is contained in:
Felix Heilmeyer
2022-05-01 17:44:35 +02:00
committed by GitHub
parent 25dce04046
commit 247208e5f5
6 changed files with 68 additions and 22 deletions

View File

@@ -1,8 +1,7 @@
import Queue from "bull";
import Redis from "ioredis";
import { snakeCase } from "lodash";
import Metrics from "@server/logging/metrics";
import { client, subscriber } from "../redis";
import Redis from "../redis";
export function createQueue(
name: string,
@@ -13,10 +12,10 @@ export function createQueue(
createClient(type) {
switch (type) {
case "client":
return client;
return Redis.defaultClient;
case "subscriber":
return subscriber;
return Redis.defaultSubscriber;
default:
return new Redis(process.env.REDIS_URL);