Chore(benchmark): Reduce server keep-alive delay in benchmark table script
authorSam Mirazi <sasan345@gmail.com>
Mon, 2 Jun 2025 04:54:44 +0000 (21:54 -0700)
committerSam Mirazi <sasan345@gmail.com>
Mon, 2 Jun 2025 04:54:44 +0000 (21:54 -0700)
This commit updates the `run_benchmark_table.py` script to shorten the keep-alive duration for web servers (FastAPI and Flask) after their respective benchmark tests complete and their pages are opened in the browser.

Previously, the script would pause for 5 seconds to allow manual viewing of the opened page. This duration has been reduced to 2 seconds.

Specific changes:
- Modified the `time.sleep()` call from `time.sleep(5)` to `time.sleep(2)` within the main scenario loop.
- Updated the corresponding console message `console.print(f"[blue]Keeping server alive for ... seconds to view the page...[/blue]")` to reflect the new 2-second delay.

This change streamlines the benchmark execution process by reducing the waiting period, making the overall benchmarking cycle faster, while still allowing a brief moment to visually confirm the server's response. This refinement is part of ongoing efforts to optimize the benchmarking utilities.

run_benchmark_table.py

index 47e56dd7500c9c5fbccb08f18bc6f03f4bf63521..c8801b933ec731b378d990499c8fe3462e2372f3 100644 (file)
@@ -236,8 +236,8 @@ if __name__ == "__main__":
                 try:
                     console.print(f"[blue]Opening {sc['name']} page at {sc['url']} in browser...[/blue]")
                     webbrowser.open(sc["url"])
-                    console.print(f"[blue]Keeping server alive for 5 seconds to view the page...[/blue]")
-                    time.sleep(5)  # Keep server alive for 5 seconds
+                    console.print(f"[blue]Keeping server alive for 2 seconds to view the page...[/blue]")
+                    time.sleep(2)  # Keep server alive for 2 seconds
                 except Exception as e:
                     console.print(f"[yellow]Could not open browser for {sc['name']}: {e}[/yellow]")
         finally: