mirror of
https://github.com/outline/outline.git
synced 2026-06-13 03:14:59 +03:00
a54e66e19a
* Lazy queues, correctly closing Redis and server * feedback * fix: Tests not correctly split across matrix
55 lines
1.4 KiB
TypeScript
55 lines
1.4 KiB
TypeScript
import { createQueue } from "@server/queues/queue";
|
|
import { Second } from "@shared/utils/time";
|
|
|
|
let cachedGlobalEventQueue: ReturnType<typeof createQueue> | undefined;
|
|
export const globalEventQueue = () => {
|
|
if (!cachedGlobalEventQueue) {
|
|
cachedGlobalEventQueue = createQueue("globalEvents", {
|
|
attempts: 5,
|
|
backoff: {
|
|
type: "exponential",
|
|
delay: Second.ms,
|
|
},
|
|
});
|
|
}
|
|
return cachedGlobalEventQueue;
|
|
};
|
|
|
|
let cachedProcessorEventQueue: ReturnType<typeof createQueue> | undefined;
|
|
export const processorEventQueue = () => {
|
|
if (!cachedProcessorEventQueue) {
|
|
cachedProcessorEventQueue = createQueue("processorEvents", {
|
|
attempts: 5,
|
|
backoff: {
|
|
type: "exponential",
|
|
delay: 10 * Second.ms,
|
|
},
|
|
});
|
|
}
|
|
return cachedProcessorEventQueue;
|
|
};
|
|
|
|
let cachedWebsocketQueue: ReturnType<typeof createQueue> | undefined;
|
|
export const websocketQueue = () => {
|
|
if (!cachedWebsocketQueue) {
|
|
cachedWebsocketQueue = createQueue("websockets", {
|
|
timeout: 10 * Second.ms,
|
|
});
|
|
}
|
|
return cachedWebsocketQueue;
|
|
};
|
|
|
|
let cachedTaskQueue: ReturnType<typeof createQueue> | undefined;
|
|
export const taskQueue = () => {
|
|
if (!cachedTaskQueue) {
|
|
cachedTaskQueue = createQueue("tasks", {
|
|
attempts: 5,
|
|
backoff: {
|
|
type: "exponential",
|
|
delay: 10 * Second.ms,
|
|
},
|
|
});
|
|
}
|
|
return cachedTaskQueue;
|
|
};
|