From 0445dce48cf31a7741d6de877a27c04773ab565d Mon Sep 17 00:00:00 2001 From: 0g-wh Date: Tue, 12 Nov 2024 14:18:52 +0800 Subject: [PATCH] Update show-tps.py --- show-tps.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/show-tps.py b/show-tps.py index e82f0ee..9b2ee35 100644 --- a/show-tps.py +++ b/show-tps.py @@ -40,13 +40,15 @@ def getTPS(url): category = 'Simple' if len(name) < 3 else name[2].strip() print(chain, category) runs = requests.get(f'{workflow['url']}/runs', headers=headers).json() - last_run = runs['workflow_runs'][0] - print(last_run['logs_url']) - best_tps, gas_used = getTPS(last_run['logs_url']) - print(best_tps, gas_used) - if chain not in res: - res[chain] = {} - res[chain][category] = (best_tps, gas_used) + for run in runs['workflow_runs']: + if run['conclusion'] == 'success': + print(run['logs_url']) + best_tps, gas_used = getTPS(run['logs_url']) + print(best_tps, gas_used) + if chain not in res: + res[chain] = {} + res[chain][category] = (best_tps, gas_used) + break print(res)