task: #3630442: Lower the retry defaults and cap the retries in web requests

Closes #3630442

Changes

Retry defaults

  • config/install/overpass_api.settings.yml: timeout 180 to 60, repeat_attempts 10 to 3. lock_time stays 8.
  • OverpassApi::__construct() falls back on the same values when a key is missing.
  • No update hook: existing sites keep their configured values.

Web requests

  • The settings form's test query and the query builder's "Run query" pass maxAttempts through OverpassQueryOptions (SettingsForm::TEST_QUERY_ATTEMPTS and QueryBuilderForm::RUN_QUERY_ATTEMPTS, both 1). Someone waiting on a form is told the endpoint failed instead of sitting through the retry budget.
  • The test query's description says it runs once, without retrying.

Retry loop

  • sendQuery() slept lock_time after every retryable failure, including the last one, right before throwing. It now sleeps only when another attempt follows.

Status report

  • The overpass_api_ui runtime requirements move to Hook\OverpassApiUiRequirements with #[Hook('runtime_requirements')]. overpass_api_ui_requirements() stays for cores before 11.3, marked #[LegacyRequirementsHook], and delegates to the same class with the REQUIREMENT_* constants, since RequirementSeverity does not exist on 10.3. Drupal 11.3 deprecates a procedural hook_requirements() without that attribute.

Notes

  • Worst case for one failing call: 10 x (180 + 8) = 1880 s with the old defaults; 3 x 60 + 2 x 8 = 196 s with the new ones; about 60 s from either form.
  • The status report change is not in the issue summary. The functional test run reported the deprecation, so it is done here.
  • Not changed here: with use_slots_timeouts on, the persistent lock taken before the retry loop is not released when the call throws. It expires timeout seconds after it was taken, so a call that fails fast can make the next one wait for the rest of that window. The setting is off by default.

Commits

  • 1665914 Lower the retry defaults to a 60 s timeout and 3 attempts
  • e50c48a Make one attempt in the settings test query and Run query
  • aaf0cdc Add a functional test for the settings form
  • 0d55aa1 Move the overpass_api_ui requirements to a runtime_requirements hook
  • d1eb3a1 Skip the lock_time wait after the last attempt

Testing

  • New functional test SettingsFormTest: access (403 / 200), the install defaults on the form, saving, and URL validation. It also covers the services injected in #3630443. No request reaches an Overpass endpoint.
  • New unit test OverpassApiTest::testWaitsOnlyBetweenAttempts(): two failing attempts with lock_time 1 take at least 1 s and less than 2 s. It fails on the previous code.
  • Locally (DDEV, Drupal 11.4.11, PostgreSQL 18, PHPUnit 11.5): unit 78/78 and the functional test pass; phpcs with the module's phpcs.xml.dist reports nothing; phpstan with the module's phpstan.neon and phpstan-drupal reports no errors.
  • On 11.4.11, runtime_requirements returns both Nominatim rows, and the class resolver returns the hook service.

Merge request reports

Loading
Loading