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.
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: