Skip to content

wikidata_stats: send maxlag on the edit only, then edit anyway - #119

Merged
forzagreen merged 1 commit into
mainfrom
fix/wikidata-stats-maxlag
Oct 7, 2026
Merged

forzagreen merged 1 commit into
mainfrom
fix/wikidata-stats-maxlag

Conversation

@forzagreen

Copy link
Copy Markdown
Owner

wikidata-stats kept failing with Wikidata is still lagging after 600 s, giving up: Waiting for wdqs1013: 6.47 seconds lagged. (run 37676802595, during login; same cause in #114's runs).

Wikidata's maxlag includes its query service's lag (WDQS lag / 60), which has been at 6–13 s for hours. With maxlag=5 on every request, the job waited out the read, the tokens and the login, and gave up before ever trying the edit. Pywikibot would not help: it sends the same maxlag=5 with a bounded number of retries.

  • Only wbeditentity carries maxlag; reads, tokens and login don't.
  • The edit waits out the lag for up to MAXLAG_WAIT (300 s), then is sent without maxlag: it is one edit per DB import (a few a week), not mass editing.
  • 429 and 5xx are retried after Retry-After for up to RETRY_WAIT (300 s); Wikimedia rate-limits shared IPs such as GitHub's runners. They used to fail immediately.
  • make wikidata_stats runs python -u, so the CI log shows progress as it happens (the failed run printed everything at the end).

Tests cover edit-only maxlag, editing without maxlag after the wait, and 429 retry / give-up.

🤖 Generated with Claude Code

https://claude.ai/code/session_01GyVN76yBTdzjfo4EzqM6uv


Generated by Claude Code

wikidata-stats kept failing with "Wikidata is still lagging after 600 s"
(run 37676802595, during login). Wikidata's maxlag includes its query
service's lag (WDQS lag / 60), which has stayed at 6-13 s for hours, so
with maxlag=5 on every request the job waited out the read, the tokens
and the login, and gave up before ever trying the edit.

- Only wbeditentity carries maxlag; reads, tokens and login don't.
- The edit waits out the lag for up to MAXLAG_WAIT (300 s), then is sent
  without maxlag: it is one edit per DB import, not mass editing.
- 429 and 5xx are retried after Retry-After for up to RETRY_WAIT (300 s);
  Wikimedia rate-limits shared IPs such as GitHub's runners.
- Run with python -u so the CI log shows progress as it happens.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GyVN76yBTdzjfo4EzqM6uv
@forzagreen
forzagreen merged commit ddabe57 into main Oct 7, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants