@@ -2156,6 +2156,33 @@ async def _locked_stop_dynamic_serivces_in_project() -> None:
21562156 await _locked_stop_dynamic_serivces_in_project ()
21572157
21582158
2159+ _CONCURRENT_NOTIFICATIONS_LIMIT : Final [int ] = 10
2160+
2161+
2162+ async def _send_message_to_project_groups (
2163+ app : web .Application ,
2164+ project_id : ProjectID ,
2165+ message : SocketMessageDict ,
2166+ ) -> None :
2167+ project_group_get_list = await _groups_service .list_project_groups_by_project_without_checking_permissions (
2168+ app , project_id = project_id
2169+ )
2170+ rooms_to_notify = [item .gid for item in project_group_get_list if item .read is True ]
2171+
2172+ await limited_gather (
2173+ * (
2174+ send_message_to_standard_group (
2175+ app ,
2176+ room ,
2177+ message ,
2178+ )
2179+ for room in rooms_to_notify
2180+ ),
2181+ log = _logger ,
2182+ limit = _CONCURRENT_NOTIFICATIONS_LIMIT ,
2183+ )
2184+
2185+
21592186async def notify_project_state_update (
21602187 app : web .Application ,
21612188 project : ProjectDict ,
@@ -2182,15 +2209,7 @@ async def notify_project_state_update(
21822209 message = message ,
21832210 )
21842211 else :
2185- project_group_get_list = await _groups_service .list_project_groups_by_project_without_checking_permissions (
2186- app , project_id = project ["uuid" ]
2187- )
2188-
2189- rooms_to_notify = [
2190- item .gid for item in project_group_get_list if item .read is True
2191- ]
2192- for room in rooms_to_notify :
2193- await send_message_to_standard_group (app , group_id = room , message = message )
2212+ await _send_message_to_project_groups (app , project ["uuid" ], message )
21942213
21952214
21962215async def notify_project_node_update (
@@ -2202,23 +2221,20 @@ async def notify_project_node_update(
22022221 if await is_project_hidden (app , ProjectID (project ["uuid" ])):
22032222 return
22042223
2205- project_group_get_list = await _groups_service .list_project_groups_by_project_without_checking_permissions (
2206- app , project_id = project ["uuid" ]
2207- )
2208- rooms_to_notify = [item .gid for item in project_group_get_list if item .read is True ]
2209-
2224+ output_project_model = ProjectGet .from_domain_model (project )
22102225 message = SocketMessageDict (
22112226 event_type = SOCKET_IO_NODE_UPDATED_EVENT ,
22122227 data = {
22132228 "project_id" : project ["uuid" ],
22142229 "node_id" : f"{ node_id } " ,
2215- "data" : project ["workbench" ][f"{ node_id } " ],
2230+ "data" : output_project_model .workbench [f"{ node_id } " ].model_dump (
2231+ ** RESPONSE_MODEL_POLICY
2232+ ),
22162233 "errors" : errors ,
22172234 },
22182235 )
22192236
2220- for room in rooms_to_notify :
2221- await send_message_to_standard_group (app , room , message )
2237+ await _send_message_to_project_groups (app , project ["uuid" ], message )
22222238
22232239
22242240async def retrieve_and_notify_project_locked_state (
0 commit comments