add online/offline api
This commit is contained in:
@@ -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}:`,
|
||||
|
||||
Reference in New Issue
Block a user