@@ -661,12 +661,10 @@ def send_rpc_call(self, method, params, callback):
661
661
self .__device_client_rpc_dict .update ({self .__device_client_rpc_number : callback })
662
662
rpc_request_id = self .__device_client_rpc_number
663
663
payload = {"method" : method , "params" : params }
664
- self ._publish_data (payload ,
665
- RPC_REQUEST_TOPIC + str (rpc_request_id ),
666
- self .quality_of_service )
664
+ self ._publish_data (payload , RPC_REQUEST_TOPIC + str (rpc_request_id ), self .quality_of_service )
667
665
668
666
def request_service_configuration (self , callback ):
669
- self .send_rpc_call ("getSessionLimits" , {}, callback )
667
+ self .send_rpc_call ("getSessionLimits" , {"timeout" : 5000 }, callback )
670
668
671
669
def on_service_configuration (self , _ , response , * args , ** kwargs ):
672
670
if "error" in response :
@@ -688,7 +686,10 @@ def on_service_configuration(self, _, response, *args, **kwargs):
688
686
if rate_limits_config .get ('telemetryDataPoints' ):
689
687
self .__telemetry_dp_rate_limit .set_limit (rate_limits_config .get ('telemetryDataPoints' ), percentage = 80 )
690
688
if service_config .get ('maxInflightMessages' ):
691
- self .max_inflight_messages_set (5 )#int(service_config.get('maxInflightMessages')))
689
+ max_inflight_messages = min (self ._messages_rate_limit .get_minimal_limit (),
690
+ self .__telemetry_rate_limit .get_minimal_limit (),
691
+ service_config .get ('maxInflightMessages' , 100 ))
692
+ self .max_inflight_messages_set (max_inflight_messages )
692
693
if service_config .get ('maxPayloadSize' ):
693
694
self .max_payload_size = int (service_config .get ('maxPayloadSize' ))
694
695
log .info ("Service configuration was successfully retrieved and applied." )
0 commit comments