Reduce DB pool size, payment concurrency, and job attempts
This commit is contained in:
parent
a929d89fb3
commit
f55ea5b731
@ -16,7 +16,7 @@ import { Payment } from '../payments/entities/payment.entity';
|
|||||||
database: configService.get('database.database'),
|
database: configService.get('database.database'),
|
||||||
entities: [Payment],
|
entities: [Payment],
|
||||||
extra: {
|
extra: {
|
||||||
max: 10,
|
max: 5,
|
||||||
// connectionTimeoutMillis: 3000,
|
// connectionTimeoutMillis: 3000,
|
||||||
},
|
},
|
||||||
synchronize: false,
|
synchronize: false,
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import { Payment } from '../entities/payment.entity';
|
|||||||
import { Repository } from 'typeorm';
|
import { Repository } from 'typeorm';
|
||||||
import { CreatePaymentDto } from '../dto/create-payment.dto';
|
import { CreatePaymentDto } from '../dto/create-payment.dto';
|
||||||
|
|
||||||
@Processor(PAYMENT_QUEUE, { concurrency: 10 })
|
@Processor(PAYMENT_QUEUE, { concurrency: 5 })
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class PaymentProcessor extends WorkerHost {
|
export class PaymentProcessor extends WorkerHost {
|
||||||
private readonly logger = new Logger(PaymentProcessor.name);
|
private readonly logger = new Logger(PaymentProcessor.name);
|
||||||
|
|||||||
@ -11,7 +11,7 @@ export class QueueService {
|
|||||||
async addPaymentJob(data: CreatePaymentDto): Promise<void> {
|
async addPaymentJob(data: CreatePaymentDto): Promise<void> {
|
||||||
await this.paymentQueue.add(PAYMENT_QUEUE, data, {
|
await this.paymentQueue.add(PAYMENT_QUEUE, data, {
|
||||||
jobId: data.correlationId,
|
jobId: data.correlationId,
|
||||||
attempts: 100,
|
attempts: 90,
|
||||||
backoff: {
|
backoff: {
|
||||||
type: 'exponential',
|
type: 'exponential',
|
||||||
delay: 100,
|
delay: 100,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user