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:
@@ -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);
|
||||
|
||||
@@ -6,7 +6,7 @@ import Document from "@server/models/Document";
|
||||
import Team from "@server/models/Team";
|
||||
import User from "@server/models/User";
|
||||
import packageInfo from "../../package.json";
|
||||
import { client } from "../redis";
|
||||
import Redis from "../redis";
|
||||
|
||||
const UPDATES_URL = "https://updates.getoutline.com";
|
||||
const UPDATES_KEY = "UPDATES_KEY";
|
||||
@@ -40,7 +40,7 @@ export async function checkUpdates() {
|
||||
documentCount,
|
||||
},
|
||||
});
|
||||
await client.del(UPDATES_KEY);
|
||||
await Redis.defaultClient.del(UPDATES_KEY);
|
||||
|
||||
try {
|
||||
const response = await fetch(UPDATES_URL, {
|
||||
@@ -54,7 +54,7 @@ export async function checkUpdates() {
|
||||
const data = await response.json();
|
||||
|
||||
if (data.severity) {
|
||||
await client.set(
|
||||
await Redis.defaultClient.set(
|
||||
UPDATES_KEY,
|
||||
JSON.stringify({
|
||||
severity: data.severity,
|
||||
|
||||
Reference in New Issue
Block a user