fix: improve Redis client shutdown handling to avoid errors
This commit is contained in:
@@ -401,6 +401,7 @@ export class SharedSaleInvoiceCreateService {
|
||||
customer,
|
||||
payments,
|
||||
settlement_type,
|
||||
send_to_tsp,
|
||||
...invoiceData
|
||||
} = data
|
||||
|
||||
|
||||
@@ -252,6 +252,17 @@ export class RedisService implements OnModuleDestroy {
|
||||
}
|
||||
|
||||
async onModuleDestroy() {
|
||||
await this.client.quit()
|
||||
if (this.client.status === 'end') {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
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