forked from 0xWheatyz/SPARC
ab3964b18d
Introduce a lightweight in-process task queue (thread + queue.Queue) so that webhook HTTP delivery no longer blocks the scheduler or batch-job background tasks. The worker thread preserves the existing exponential- backoff retry logic from _send_with_retry. - Add SPARC/task_queue.py: WebhookTask, start/stop worker, enqueue, drain - Add enqueue_notify / enqueue_job_completed / enqueue_alert to webhooks.py - Update api.py lifespan to start/stop the webhook worker - Update _run_batch_job to use enqueue_job_completed (non-blocking) - Update scheduler to fire enqueue_alert on patent count changes - Add 13 tests covering worker lifecycle, async delivery, retry in worker context, and integration via enqueue helpers - All 22 existing webhook tests continue to pass unchanged Closes leeworks-agents/SPARC#1676 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>