@@ -717,28 +717,30 @@ async def observer_loop(config: Configuration) -> None:
717717 "method" : "platform.getCurrentValidators" ,
718718 "params" : {"nodeIDs" : node_ids },
719719 }
720- if int (time .time () - last_ping ) > uptime_validation_frequency :
721- if len (node_ids ) > 0 :
722- try :
723- response = requests .post (
724- config .p_chain_rpc_url , json = payload , timeout = 10
725- )
726- response .raise_for_status ()
727- result = response .json ()
728- if "error" in result :
729- LOGGER .warning ("Error calling API: check params" )
730- continue
731-
732- if (
733- uptime_validations
734- < minimal_conditions .time_period .value
735- // uptime_validation_frequency
736- ):
737- uptime_validations += 1
738- for node in result ["result" ]["validators" ]:
739- node_connections [node ["nodeID" ]].append (node ["connected" ])
740- except requests .RequestException as e :
741- LOGGER .warning (f"Error calling API: { e } " )
720+ if (
721+ int (time .time () - last_ping ) > uptime_validation_frequency
722+ and len (node_ids ) > 0
723+ ):
724+ try :
725+ response = requests .post (
726+ config .p_chain_rpc_url , json = payload , timeout = 10
727+ )
728+ response .raise_for_status ()
729+ result = response .json ()
730+ if "error" in result :
731+ LOGGER .warning ("Error calling API: check params" )
732+ continue
733+
734+ if (
735+ uptime_validations
736+ < minimal_conditions .time_period .value
737+ // uptime_validation_frequency
738+ ):
739+ uptime_validations += 1
740+ for node in result ["result" ]["validators" ]:
741+ node_connections [node ["nodeID" ]].append (node ["connected" ])
742+ except requests .RequestException as e :
743+ LOGGER .warning (f"Error calling API: { e } " )
742744 last_ping = int (time .time ())
743745
744746 if int (time .time ()) - cron_time > 60 * 60 :
0 commit comments