rss-news/backend/app
OliverGiertz f710141828 fix(scheduler): prevent duplicate slot assignment from concurrent pipeline runs
Two bugs caused multiple articles to land on the same publish slot:

1. main.py: asyncio.create_task() returned immediately, allowing a second
   pipeline trigger (N8N + Telegram /run or two N8N calls) to start a
   second concurrent run. Added asyncio.Lock (_pipeline_lock) so any
   second trigger while the pipeline is running is rejected immediately.

2. scheduler.py: reserve_publish_slot() read the list of occupied slots
   and wrote the new slot in two separate DB connections. Concurrent threads
   could both see the same "free" slot before either committed its write.
   Fixed by wrapping the entire read-find-write cycle in a threading.Lock
   (_slot_lock) and a single DB connection, so the slot check and the
   slot assignment are atomic.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-08 05:03:13 +00:00
..
__init__.py feat: rebuild rss-news backend, admin ui, and legal extraction pipeline 2026-02-18 09:52:36 +01:00
admin_ui.py feat(admin): bulk-editable article list with WP ID inline editing 2026-04-10 09:00:25 +00:00
auth.py feat: rebuild rss-news backend, admin ui, and legal extraction pipeline 2026-02-18 09:52:36 +01:00
config.py feat(pipeline): article age filter, image URL validation, schedule UI, retry button 2026-04-10 08:44:28 +00:00
db.py feat(pipeline): image caption/credit extraction, no-image exclusion, WP attribution 2026-03-27 07:08:48 +00:00
ingestion.py feat(pipeline): article age filter, image URL validation, schedule UI, retry button 2026-04-10 08:44:28 +00:00
main.py fix(scheduler): prevent duplicate slot assignment from concurrent pipeline runs 2026-05-08 05:03:13 +00:00
pipeline.py feat(pipeline): article age filter, image URL validation, schedule UI, retry button 2026-04-10 08:44:28 +00:00
policy.py feat: rebuild rss-news backend, admin ui, and legal extraction pipeline 2026-02-18 09:52:36 +01:00
publisher.py feat(workflow): simplify article flow and add automated rewrite step 2026-02-21 13:43:22 +01:00
relevance.py feat(export): add csv/json article export with date relevance scoring 2026-02-18 10:04:38 +01:00
repositories.py feat(admin): bulk-editable article list with WP ID inline editing 2026-04-10 09:00:25 +00:00
rewrite.py fix(rewrite): attribute claims to source instead of using first-person 'wir' 2026-03-26 07:36:09 +00:00
scheduler.py fix(scheduler): prevent duplicate slot assignment from concurrent pipeline runs 2026-05-08 05:03:13 +00:00
source_extraction.py feat(pipeline): image caption/credit extraction, no-image exclusion, WP attribution 2026-03-27 07:08:48 +00:00
telegram_bot.py fix(pipeline): send individual Telegram notifications for quality gate rejections 2026-04-09 07:02:03 +00:00
wordpress.py feat(admin): WordPress→DB sync for scheduled slots 2026-04-10 08:53:44 +00:00
workflow.py feat(pipeline): image caption/credit extraction, no-image exclusion, WP attribution 2026-03-27 07:08:48 +00:00