diff --git a/src/socket/socket.service.ts b/src/socket/socket.service.ts index 0518f2a..d6c646a 100644 --- a/src/socket/socket.service.ts +++ b/src/socket/socket.service.ts @@ -1,7 +1,7 @@ import { HttpService } from '@nestjs/axios'; import { Injectable, Logger } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; -import { firstValueFrom } from 'rxjs'; +import { firstValueFrom, retry } from 'rxjs'; import { Socket } from 'socket.io'; import { Repository } from 'typeorm'; import { ClientConnectionDto } from './dto/clientConnection.dto'; @@ -30,7 +30,9 @@ export class SocketService { if (endpoint) { const url = `${process.env.SERVICE_URL}${endpoint}?telephone_id=${client.client_id}`; try { - await firstValueFrom(this.httpService.get(url)); + await firstValueFrom( + this.httpService.get(url, { timeout: 3000 }).pipe(retry(3)), + ); } catch (error) { this.logger.error( `❌ Failed to notify ${data.event} for client ${client.client_id}:`,