Phases 2-4: Requester support, batches, webhooks, scraper registry
Phase 2 - Requester & Batch Support:
- core/database.py: Added create_job params (requester_*, batch_*, priority, callback_*)
- core/database.py: Added batch methods (create_batch, get_batch, update_batch_progress, get_batches)
- core/database.py: Added update_job_callback for tracking webhook delivery
- api/routes/batches.py: New endpoints:
- POST /api/scrape/google-reviews/batch (submit batch)
- GET /api/batches (list batches)
- GET /api/batches/{id} (batch detail)
- DELETE /api/batches/{id} (cancel batch)
- api_server_production.py: Updated /api/scrape with requester, priority, callback fields
- api_server_production.py: New primary endpoint POST /api/scrape/google-reviews
Phase 3 - Webhooks:
- services/job_callback_service.py: New service with:
- JobCallbackService: send_job_callback, send_batch_callback, retry_failed_callbacks
- JobCallbackDispatcher: Background worker for callback monitoring
- Payload formats per spec (job.completed, job.failed, batch.completed)
- Exponential backoff for retries
- Error classification for failure payloads
Phase 4 - Scraper Registry:
- scrapers/registry.py: Database-backed version routing:
- get_scraper(): Version/variant/A/B routing
- _get_weighted_scraper(): Traffic-weighted random selection
- 60-second TTL cache for performance
- register_scraper, deprecate_scraper, update_traffic_allocation
- LegacyScraperRegistry preserved for backwards compatibility
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
"""
|
||||
Services module for ReviewIQ platform.
|
||||
|
||||
Contains service classes for webhook delivery, job callbacks, and other
|
||||
business logic.
|
||||
"""
|
||||
from services.webhook_service import (
|
||||
WebhookManager,
|
||||
WebhookDispatcher,
|
||||
WebhookDeliveryError,
|
||||
verify_webhook_signature
|
||||
)
|
||||
from services.job_callback_service import (
|
||||
JobCallbackService,
|
||||
JobCallbackDispatcher,
|
||||
CallbackStatus
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
# Webhook service
|
||||
'WebhookManager',
|
||||
'WebhookDispatcher',
|
||||
'WebhookDeliveryError',
|
||||
'verify_webhook_signature',
|
||||
# Job callback service
|
||||
'JobCallbackService',
|
||||
'JobCallbackDispatcher',
|
||||
'CallbackStatus',
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user