From e5eb98c8a0ef22f98ea02601c3d25b094a2adb1f Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Sun, 21 Jun 2026 17:20:52 +0200 Subject: [PATCH] nix(loadtest): fix postgrest-loadtest-report locally The script currently depends on results from "head" and "main" to be present to calculate the change ratio. Fallback nicely in case these are not available, which allows using the same to report URL-by-URL stats locally. --- nix/tools/loadtest.nix | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/nix/tools/loadtest.nix b/nix/tools/loadtest.nix index 0e08c9c75..47150e2e3 100644 --- a/nix/tools/loadtest.nix +++ b/nix/tools/loadtest.nix @@ -279,12 +279,15 @@ let def evaluate_change(df): - return ((df['head'] / df['main'] - 1) * 100) \ - .map(lambda r: "{icon} {ratio:.1f} %".format( - ratio=r, - # Hardcoded failure threshold for CI is 5% here. - icon="" if r < 5 else ":x:" - )) + try: + return ((df['head'] / df['main'] - 1) * 100) \ + .map(lambda r: "{icon} {ratio:.1f} %".format( + ratio=r, + # Hardcoded failure threshold for CI is 5% here. + icon="" if r < 5 else ":x:" + )) + except KeyError: + return None pd.read_json(sys.stdin) \