fix(scheduler,pipeline): fix WP auth attribute name and release slot on hard errors

- scheduler: use wordpress_app_password (not wordpress_password) so
  _fetch_wp_occupied_slots() can actually authenticate against the WP
  REST API — previously always returned empty set silently
- pipeline: release reserved publish slot when draft creation fails with
  a non-ValueError exception (e.g. WP API error), preventing permanently
  blocked slots on failed articles

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
OliverGiertz 2026-04-10 08:22:26 +00:00
parent 2d1dd14e45
commit cf2d826c8a
2 changed files with 4 additions and 1 deletions

View file

@ -391,6 +391,9 @@ def _process_article(article: dict[str, Any], stats: PipelineStats, settings: An
except Exception as exc:
logger.error("Draft-Erstellung für #%d fehlgeschlagen: %s", article_id, exc)
update_article_status(article_id, "error", actor="pipeline", note=f"Draft-Fehler: {exc}")
# Release reserved slot so it's not permanently blocked by a failed article
from .scheduler import release_publish_slot
release_publish_slot(article_id)
raise

View file

@ -45,7 +45,7 @@ def _fetch_wp_occupied_slots() -> set[tuple[str, int]]:
settings = get_settings()
try:
auth = base64.b64encode(
f"{settings.wordpress_username}:{settings.wordpress_password}".encode()
f"{settings.wordpress_username}:{settings.wordpress_app_password}".encode()
).decode()
url = (
f"{settings.wordpress_base_url}/wp-json/wp/v2/posts"