19 lines
552 B
TypeScript
Executable File
19 lines
552 B
TypeScript
Executable File
import { SharedBullAsyncConfiguration } from "@nestjs/bullmq";
|
|
import { ConfigService } from "@nestjs/config";
|
|
|
|
export function bullMqConfig(): SharedBullAsyncConfiguration {
|
|
return {
|
|
inject: [ConfigService],
|
|
useFactory: async (configService: ConfigService) => ({
|
|
connection: {
|
|
url: configService.getOrThrow<string>("REDIS_URI"),
|
|
},
|
|
defaultJobOptions: {
|
|
removeOnComplete: false,
|
|
removeOnFail: false,
|
|
attempts: 5, // Reasonable default, adjust based on job criticality
|
|
},
|
|
}),
|
|
};
|
|
}
|