AI da dat ten cho dong song
This commit is contained in:
@@ -42,11 +42,11 @@ export class PrismaService extends PrismaClient implements OnModuleInit {
|
||||
await this.$connect();
|
||||
break; // Exit loop if connection is successful
|
||||
} catch (error) {
|
||||
if (attempt < 3) {
|
||||
if (attempt < (parseInt(process.env.PRISMA_MAX_RETRY as string) ?? 3)) {
|
||||
this.logger.warn(
|
||||
`Connection attempt ${attempt} failed. Retrying in 5000ms...`,
|
||||
`Connection attempt ${attempt} failed. Retrying in 10000ms...`,
|
||||
);
|
||||
await new Promise((resolve) => setTimeout(resolve, 5000));
|
||||
await new Promise((resolve) => setTimeout(resolve, 10000));
|
||||
} else {
|
||||
this.logger.error(
|
||||
'Failed to connect to the database after 3 attempts.',
|
||||
|
||||
Reference in New Issue
Block a user