@@ -84,7 +84,6 @@ export class PropertyDefsConsumer {
84
84
protected promises : Set < Promise < any > > = new Set ( )
85
85
86
86
constructor ( private hub : Hub ) {
87
- // The group and topic are configurable allowing for multiple ingestion consumers to be run in parallel
88
87
this . groupId = hub . PROPERTY_DEFS_CONSUMER_GROUP_ID
89
88
this . topic = hub . PROPERTY_DEFS_CONSUMER_CONSUME_TOPIC
90
89
this . propertyDefsDB = new PropertyDefsDB ( hub )
@@ -146,21 +145,24 @@ export class PropertyDefsConsumer {
146
145
}
147
146
148
147
const teamsInBatch = this . extractTeamIds ( parsedMessages )
149
- collected . knownTeamIds = await this . runInstrumented ( 'resolveTeams' , ( ) =>
150
- Promise . resolve ( this . resolveTeams ( this . propertyDefsDB , teamsInBatch ) )
151
- )
152
-
153
148
const groupTeamsInBatch = this . extractGroupTeamIds ( parsedMessages , collected . knownTeamIds )
154
- collected . resolvedTeamGroups = await this . runInstrumented ( 'resolveGroupsForTeams' , ( ) =>
155
- Promise . resolve ( this . resolveGroupsForTeams ( this . propertyDefsDB , groupTeamsInBatch ) )
156
- )
149
+
150
+ const [ knownTeamIds , resolvedTeamGroups ] = await Promise . all ( [
151
+ this . runInstrumented ( 'resolveTeams' , ( ) => this . resolveTeams ( this . propertyDefsDB , teamsInBatch ) ) ,
152
+ this . runInstrumented ( 'resolveGroupsForTeams' , ( ) =>
153
+ this . resolveGroupsForTeams ( this . propertyDefsDB , groupTeamsInBatch )
154
+ ) ,
155
+ ] )
156
+
157
+ collected . knownTeamIds = knownTeamIds
158
+ collected . resolvedTeamGroups = resolvedTeamGroups
157
159
158
160
console . log ( '🔁' , `Event batch teams and group indices resolved` )
159
161
160
162
// extract and dedup event and property definitions
161
- void ( await this . runInstrumented ( 'derivePropDefs' , ( ) =>
163
+ await this . runInstrumented ( 'derivePropDefs' , ( ) =>
162
164
Promise . resolve ( this . extractPropertyDefinitions ( parsedMessages , collected ) )
163
- ) )
165
+ )
164
166
165
167
console . log ( '🔁' , `Property definitions collected` , JSON . stringify ( collected , null , 2 ) )
166
168
0 commit comments