Fallout winds: make the daily download at 23 past the hour (#1020)
Some checks failed
Backend Tests / api-tests (core) (push) Has been cancelled
Backend Tests / api-tests (files) (push) Has been cancelled
Backend Tests / api-tests (media) (push) Has been cancelled
Backend Tests / api-tests (rest) (push) Has been cancelled
Backend Tests / api-contract-tests (push) Has been cancelled
Backend Tests / api-migrations-and-start (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
Controller Tests / controller-tests (push) Has been cancelled
Cypress Tests / cypress-component-tests (push) Has been cancelled
Cypress Tests / cypress-e2e-tests (push) Has been cancelled
Dead Code / vulture (push) Has been cancelled
Jest Tests / jest-tests (push) Has been cancelled

Daily downloads are spread over the day in slots which fall on the hour, when the
forecast service is busiest.  On .5 its TLS handshake stalled for minutes there,
failing the download.  The weather downloader now schedules its next run itself, a
day later at 23 minutes past the hour.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
lrnselfreliance 2026-11-26 17:23:54 -07:00 • committed by GitHub
parent f58c86af88
commit 68d8eadd69
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 26 additions and 1 deletions

View file

@ -1,4 +1,5 @@
import json
from datetime import datetime, timedelta
from http import HTTPStatus
from unittest import mock
@ -320,6 +321,21 @@ async def test_weather_subscription(async_client, test_session, test_directory,
assert response.status_code == HTTPStatus.BAD_REQUEST
@pytest.mark.parametrize('finished,expected', [
('2026-11-27T00:07:30+00:00', '2026-11-28T00:23:00+00:00'),
('2026-11-27T14:00:11+00:00', '2026-11-28T14:23:00+00:00'),
('2026-11-27T14:59:59+00:00', '2026-11-28T14:23:00+00:00'),
])
def test_weather_downloader_avoids_the_hour(finished, expected):
"""The next day's download is at WEATHER_MINUTE past an hour, when the forecast service is not
busy with requests made on the hour."""
with mock.patch('modules.map.winds.now', lambda: datetime.fromisoformat(finished)):
result = winds.weather_downloader.finalize_download(None, None, winds.ExecutedWeather(points=1))
assert result.success is True
assert datetime.fromisoformat(finished) + timedelta(seconds=result.retry_seconds) \
== datetime.fromisoformat(expected)
@pytest.mark.asyncio
async def test_weather_downloader(test_session, test_directory, test_nuclear_config):
"""The downloader fetches a field around the saved targets, telling how far it has got."""