Add retry logic for transient connection failures in benchmark.py

Summary

Adds retry logic to benchmark.py to handle transient connection failures during CI jobs.

Problem

The postgrest_block_api_benchmark_tests job was failing intermittently with DNS resolution errors:

Failed to resolve 'app' ([Errno -3] Try again)

This happens due to a race condition where the test starts before GitLab CI service containers are fully ready and DNS-registered.

Solution

  • Added post_with_retry() function with configurable retry attempts (default: 10) and delay (default: 5s)
  • Catches ConnectionError, Timeout, and OSError (which includes DNS failures)
  • Changed the version check call to use retry logic
  • Clear logging of retry attempts for debugging

Testing

This fix works as defense-in-depth alongside a TCP port wait added to the CI job template.

Merge request reports

Loading