@@ -312,17 +312,25 @@ def get_ok_error(value: str):
312312 data ['ls_queries' ]['error' ] = int (k .split (':' )[1 ])
313313 statistics = local .db .get ("statistics" , dict ())
314314
315- if time .time () - int (status .start_time ) <= 60 : # was node restart <60 sec ago, resetting node statistics
315+ # if time.time() - int(status.start_time) <= 60: # was node restart <60 sec ago, resetting node statistics
316+ # statistics['node'] = []
317+
318+ if 'node' not in statistics :
316319 statistics ['node' ] = []
317320
318- # statistics['node'] = [stats_from_election_id, stats_from_prev_min, stats_now]
321+ if statistics ['node' ]:
322+ if int (status .start_time ) > statistics ['node' ][- 1 ]['timestamp' ]:
323+ # node was restarted, reset node statistics
324+ statistics ['node' ] = []
325+
326+ # statistics['node']: [stats_from_election_id, stats_from_prev_min, stats_now]
319327
320328 election_id = ton .GetConfig34 (no_cache = True )['startWorkTime' ]
321- if 'node' not in statistics or len (statistics ['node' ]) == 0 :
329+ if len (statistics ['node' ]) == 0 :
322330 statistics ['node' ] = [None , data ]
323331 elif len (statistics ['node' ]) < 3 :
324332 statistics ['node' ].append (data )
325- if len (statistics ['node' ]) == 3 :
333+ elif len (statistics ['node' ]) == 3 :
326334 if statistics ['node' ][0 ] is None :
327335 if 0 < data ['timestamp' ] - election_id < 90 :
328336 statistics ['node' ][0 ] = data
0 commit comments