@@ -263,10 +263,13 @@ class HashTreeParser {
263263 return this . sendSyncRequestToLocus ( this . dataSets [ datasetName ] , emptyLeavesData ) . then (
264264 ( syncResponse ) => {
265265 if ( syncResponse ) {
266- return this . parseMessage (
267- syncResponse ,
268- `via empty leaves /sync API call for ${ debugText } `
269- ) ;
266+ return {
267+ updateType : LocusInfoUpdateType . OBJECTS_UPDATED ,
268+ updatedObjects : this . parseMessage (
269+ syncResponse ,
270+ `via empty leaves /sync API call for ${ debugText } `
271+ ) ,
272+ } ;
270273 }
271274
272275 return { updateType : LocusInfoUpdateType . OBJECTS_UPDATED , updatedObjects : [ ] } ;
@@ -396,15 +399,6 @@ class HashTreeParser {
396399 // eslint-disable-next-line no-await-in-loop
397400 const data = await this . sendInitializationSyncRequestToLocus ( name , debugText ) ;
398401
399- if ( data . updateType === LocusInfoUpdateType . MEETING_ENDED ) {
400- LoggerProxy . logger . warn (
401- `HashTreeParser#initializeDataSets --> ${ this . debugId } meeting ended while initializing new visible data set "${ name } "`
402- ) ;
403-
404- // throw an error, it will be caught higher up and the meeting will be destroyed
405- throw new MeetingEndedError ( ) ;
406- }
407-
408402 if ( data . updateType === LocusInfoUpdateType . OBJECTS_UPDATED ) {
409403 updatedObjects . push ( ...( data . updatedObjects || [ ] ) ) ;
410404 }
@@ -943,12 +937,9 @@ class HashTreeParser {
943937 *
944938 * @param {HashTreeMessage } message - The hash tree message containing data sets and objects to be processed
945939 * @param {string } [debugText] - Optional debug text to include in logs
946- * @returns {Promise }
940+ * @returns {HashTreeObject[] } list of hash tree objects that were updated as a result of processing the message
947941 */
948- private async parseMessage (
949- message : HashTreeMessage ,
950- debugText ?: string
951- ) : Promise < { updateType : LocusInfoUpdateType ; updatedObjects ?: HashTreeObject [ ] } > {
942+ private parseMessage ( message : HashTreeMessage , debugText ?: string ) : HashTreeObject [ ] {
952943 const { dataSets, visibleDataSetsUrl} = message ;
953944
954945 LoggerProxy . logger . info (
@@ -966,7 +957,6 @@ class HashTreeParser {
966957 this . visibleDataSetsUrl = visibleDataSetsUrl ;
967958 dataSets . forEach ( ( dataSet ) => this . updateDataSetInfo ( dataSet ) ) ;
968959
969- let isRosterDropped = false ;
970960 const updatedObjects : HashTreeObject [ ] = [ ] ;
971961
972962 // when we detect new visible datasets, it may be that the metadata about them is not
@@ -1032,9 +1022,6 @@ class HashTreeParser {
10321022 zip ( appliedChangesList , locusStateElementsForThisSet ) . forEach (
10331023 ( [ changeApplied , object ] ) => {
10341024 if ( changeApplied ) {
1035- if ( isSelf ( object ) && ! object . data ) {
1036- isRosterDropped = true ;
1037- }
10381025 // add to updatedObjects so that our locus DTO will get updated with the new object
10391026 updatedObjects . push ( object ) ;
10401027 }
@@ -1047,22 +1034,10 @@ class HashTreeParser {
10471034 }
10481035 }
10491036
1050- if ( ! isRosterDropped ) {
1051- this . runSyncAlgorithm ( dataSet ) ;
1052- }
1037+ this . runSyncAlgorithm ( dataSet ) ;
10531038 } ) ;
10541039 }
10551040
1056- if ( isRosterDropped ) {
1057- LoggerProxy . logger . info (
1058- `HashTreeParser#parseMessage --> ${ this . debugId } detected roster drop`
1059- ) ;
1060- this . stopAllTimers ( ) ;
1061-
1062- // in case of roster drop we don't care about other updates
1063- return { updateType : LocusInfoUpdateType . MEETING_ENDED } ;
1064- }
1065-
10661041 if ( dataSetsRequiringInitialization . length > 0 ) {
10671042 // there are some data sets that we need to initialize asynchronously
10681043 this . queueInitForNewVisibleDataSets ( dataSetsRequiringInitialization ) ;
@@ -1074,7 +1049,7 @@ class HashTreeParser {
10741049 ) ;
10751050 }
10761051
1077- return { updateType : LocusInfoUpdateType . OBJECTS_UPDATED , updatedObjects} ;
1052+ return updatedObjects ;
10781053 }
10791054
10801055 /**
@@ -1084,7 +1059,7 @@ class HashTreeParser {
10841059 * @param {string } [debugText] - Optional debug text to include in logs
10851060 * @returns {void }
10861061 */
1087- async handleMessage ( message : HashTreeMessage , debugText ?: string ) : Promise < void > {
1062+ handleMessage ( message : HashTreeMessage , debugText ?: string ) {
10881063 if ( message . heartbeatIntervalMs ) {
10891064 this . heartbeatIntervalMs = message . heartbeatIntervalMs ;
10901065 }
@@ -1099,14 +1074,13 @@ class HashTreeParser {
10991074 this . handleRootHashHeartBeatMessage ( message ) ;
11001075 this . resetHeartbeatWatchdogs ( message . dataSets ) ;
11011076 } else {
1102- const updates = await this . parseMessage ( message , debugText ) ;
1103-
1104- // Only reset watchdogs if the meeting hasn't ended
1105- if ( updates . updateType !== LocusInfoUpdateType . MEETING_ENDED ) {
1106- this . resetHeartbeatWatchdogs ( message . dataSets ) ;
1107- }
1077+ const updatedObjects = this . parseMessage ( message , debugText ) ;
11081078
1109- this . callLocusInfoUpdateCallback ( updates ) ;
1079+ this . resetHeartbeatWatchdogs ( message . dataSets ) ;
1080+ this . callLocusInfoUpdateCallback ( {
1081+ updateType : LocusInfoUpdateType . OBJECTS_UPDATED ,
1082+ updatedObjects,
1083+ } ) ;
11101084 }
11111085 }
11121086
0 commit comments