Loading
task: #3630442: Lower the retry defaults and cap the retries in web requests
Closes #3630442
Changes
Retry defaults
config/install/overpass_api.settings.yml:timeout180 to 60,repeat_attempts10 to 3.lock_timestays 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
maxAttemptsthroughOverpassQueryOptions(SettingsForm::TEST_QUERY_ATTEMPTSandQueryBuilderForm::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()sleptlock_timeafter every retryable failure, including the last one, right before throwing. It now sleeps only when another attempt follows.
Status report
- The
overpass_api_uiruntime requirements move toHook\OverpassApiUiRequirementswith#[Hook('runtime_requirements')].overpass_api_ui_requirements()stays for cores before 11.3, marked#[LegacyRequirementsHook], and delegates to the same class with theREQUIREMENT_*constants, sinceRequirementSeveritydoes not exist on 10.3. Drupal 11.3 deprecates a proceduralhook_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_timeoutson, the persistent lock taken before the retry loop is not released when the call throws. It expirestimeoutseconds 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
1665914Lower the retry defaults to a 60 s timeout and 3 attemptse50c48aMake one attempt in the settings test query and Run queryaaf0cdcAdd a functional test for the settings form0d55aa1Move the overpass_api_ui requirements to a runtime_requirements hookd1eb3a1Skip 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 withlock_time1 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.distreports nothing; phpstan with the module'sphpstan.neonand phpstan-drupal reports no errors. - On 11.4.11,
runtime_requirementsreturns both Nominatim rows, and the class resolver returns the hook service.