fix: improve Redis client shutdown handling to avoid errors

This commit is contained in:
2026-06-17 14:57:52 +03:30
parent 9bf294a1f3
commit 636daca703
2 changed files with 13 additions and 1 deletions
@@ -401,6 +401,7 @@ export class SharedSaleInvoiceCreateService {
customer,
payments,
settlement_type,
send_to_tsp,
...invoiceData
} = data
+12 -1
View File
@@ -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}`)
}
}
}
}