From fae9e6fd33fa0c1e8b3e5d918b455912911f50e0 Mon Sep 17 00:00:00 2001 From: Vladimir Berdnikov Date: Thu, 1 Aug 2024 17:49:19 +0300 Subject: [PATCH] ULMS-3222 Deleted unused entity events --- package-lock.json | 4 ++-- package.json | 2 +- src/broker.js | 12 ------------ src/common.js | 39 ++------------------------------------- 4 files changed, 5 insertions(+), 52 deletions(-) diff --git a/package-lock.json b/package-lock.json index 293eb0e..a7f6dfe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@ulms/api-clients", - "version": "7.9.8", + "version": "7.9.9-dev.0-ULMS-3222", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@ulms/api-clients", - "version": "7.9.8", + "version": "7.9.9-dev.0-ULMS-3222", "license": "MIT", "dependencies": { "axios": "1.6.2", diff --git a/package.json b/package.json index 1834694..a078112 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ulms/api-clients", - "version": "7.9.8", + "version": "7.9.9-dev.0-ULMS-3222", "description": "JavaScript API clients for ULMS platform", "keywords": [], "homepage": "https://github.com/foxford/ulms-api-clients-js#readme", diff --git a/src/broker.js b/src/broker.js index 6c8c221..cbdd218 100644 --- a/src/broker.js +++ b/src/broker.js @@ -30,13 +30,7 @@ const entityEventsEnum = { CLASSROOM_ENTER: 'classroom.enter', CLASSROOM_LEAVE: 'classroom.leave', CLASSROOM_UPDATE: 'classroom.update', - CONFERENCE_ROOM_CLOSE: 'conference_room.close', - CONFERENCE_ROOM_ENTER: 'conference_room.enter', - CONFERENCE_ROOM_LEAVE: 'conference_room.leave', EVENT_CREATE: 'event.create', - EVENT_ROOM_ENTER: 'event_room.enter', - EVENT_ROOM_LEAVE: 'event_room.leave', - EVENT_ROOM_UPDATE: 'event_room.update', GROUP_UPDATE: 'video_group.update', RTC_STREAM_AGENT_SPEAKING: 'rtc_stream.agent_speaking', RTC_STREAM_UPDATE: 'rtc_stream.update', @@ -52,13 +46,7 @@ class Broker { * CLASSROOM_ENTER: string, * CLASSROOM_LEAVE: string, * CLASSROOM_UPDATE: string, - * CONFERENCE_ROOM_CLOSE: string, - * CONFERENCE_ROOM_ENTER: string, - * CONFERENCE_ROOM_LEAVE: string, * EVENT_CREATE: string, - * EVENT_ROOM_ENTER: string, - * EVENT_ROOM_LEAVE: string, - * EVENT_ROOM_UPDATE: string, * GROUP_UPDATE: string, * RTC_STREAM_AGENT_SPEAKING: string, * RTC_STREAM_UPDATE: string, diff --git a/src/common.js b/src/common.js index cdd832f..981ac33 100644 --- a/src/common.js +++ b/src/common.js @@ -69,32 +69,9 @@ export async function enterServiceRoom( ) { const backoff = new Backoff() const isTransportConnected = () => client.mqtt.connected - let enterEventRoomSuccess = false - let enterConferenceRoomSuccess = false let enterClassroomSuccess = false let response - const handlerEnterEventRoom = (event) => { - if (event.data.agent_id === id) { - console.log('[handlerEnterEventRoom] enterEventRoomSuccess') - enterEventRoomSuccess = true - - client.off(Broker.events.EVENT_ROOM_ENTER, handlerEnterEventRoom) - } - } - - const handlerEnterConferenceRoom = (event) => { - if (event.data.agent_id === id) { - console.log('[handlerEnterConferenceRoom] enterConferenceRoomSuccess') - enterConferenceRoomSuccess = true - - client.off( - Broker.events.CONFERENCE_ROOM_ENTER, - handlerEnterConferenceRoom, - ) - } - } - const handlerEnterClassroom = (event) => { if (event.data.agent_id === id) { console.log('[handlerEnterClassroom] enterClassroomSuccess') @@ -104,8 +81,6 @@ export async function enterServiceRoom( } } - client.on(Broker.events.EVENT_ROOM_ENTER, handlerEnterEventRoom) - client.on(Broker.events.CONFERENCE_ROOM_ENTER, handlerEnterConferenceRoom) client.on(Broker.events.CLASSROOM_ENTER, handlerEnterClassroom) try { @@ -122,28 +97,18 @@ export async function enterServiceRoom( throw new Error('MQTT client disconnected') } - if ( - enterClassroomSuccess || - (enterEventRoomSuccess && enterConferenceRoomSuccess) - ) - break + if (enterClassroomSuccess) break // eslint-disable-next-line no-await-in-loop await sleep(backoff.value) backoff.next() - if ( - enterClassroomSuccess || - (enterEventRoomSuccess && enterConferenceRoomSuccess) - ) - break + if (enterClassroomSuccess) break trackEvent('Debug', `${serviceName}.Subscription.Retry`) } } catch (error) { - client.off(Broker.events.EVENT_ROOM_ENTER, handlerEnterEventRoom) - client.off(Broker.events.CONFERENCE_ROOM_ENTER, handlerEnterConferenceRoom) client.off(Broker.events.CLASSROOM_ENTER, handlerEnterClassroom) backoff.reset()