fix: improve Redis client shutdown handling to avoid errors
This commit is contained in:
@@ -401,6 +401,7 @@ export class SharedSaleInvoiceCreateService {
|
|||||||
customer,
|
customer,
|
||||||
payments,
|
payments,
|
||||||
settlement_type,
|
settlement_type,
|
||||||
|
send_to_tsp,
|
||||||
...invoiceData
|
...invoiceData
|
||||||
} = data
|
} = data
|
||||||
|
|
||||||
|
|||||||
@@ -252,6 +252,17 @@ export class RedisService implements OnModuleDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async onModuleDestroy() {
|
async onModuleDestroy() {
|
||||||
|
if (this.client.status === 'end') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
await this.client.quit()
|
await this.client.quit()
|
||||||
|
} catch (error) {
|
||||||
|
const message = (error as Error)?.message || ''
|
||||||
|
if (!message.includes('Connection is closed')) {
|
||||||
|
this.logger.warn(`Redis shutdown failed: ${message}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user