Refactor queue management to use lazy initialization and improve Redis connection handling
- Updated queue and QueueEvents initialization to be lazy, preventing unnecessary Redis connections during the build process. - Refactored queue access methods to ensure consistent connection handling across the application. - Enhanced error handling for Redis connections during production builds to reduce log noise.
This commit is contained in:
@@ -7,7 +7,7 @@ import type {
|
||||
} from '@nexumi/shared';
|
||||
import type { Suggestion } from '@prisma/client';
|
||||
import { prisma } from '../prisma';
|
||||
import { addJobAndAwait, suggestionsQueue, suggestionsQueueEvents } from '../queues';
|
||||
import { addJobAndAwait, getSuggestionsQueue, getSuggestionsQueueEvents } from '../queues';
|
||||
|
||||
export class SuggestionActionTimeoutError extends Error {
|
||||
constructor() {
|
||||
@@ -105,8 +105,8 @@ export async function applySuggestionAction(
|
||||
}
|
||||
|
||||
const { confirmed } = await addJobAndAwait<{ id: string }>(
|
||||
suggestionsQueue,
|
||||
suggestionsQueueEvents,
|
||||
getSuggestionsQueue(),
|
||||
getSuggestionsQueueEvents(),
|
||||
'suggestionStatusUpdate',
|
||||
{
|
||||
suggestionId,
|
||||
|
||||
Reference in New Issue
Block a user