- Evotor catalog: background Celery task syncing stores/groups/products from Evotor API; UI pages with per-store and per-group sync toggles - VK connection: manual token + group ID entry with inline test button - Evotor connection: inline test button (calls /stores) - VK catalog: background task syncing VK Market albums and products; separate catalog UI at /vk-catalog/albums - SyncFilter extended to support entity_type=group with parent_entity_id - Migration 0004: vk_cached_albums + vk_cached_products tables - Beat schedule updated to run both refresh_catalog and refresh_vk_catalog - README updated with new schema, routes, tasks, and config Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
38 lines
1.2 KiB
Python
38 lines
1.2 KiB
Python
from celery import Celery
|
|
from celery.schedules import timedelta
|
|
|
|
from web.config import settings
|
|
|
|
celery_app = Celery("evosync", broker=settings.REDIS_URL, backend=settings.REDIS_URL)
|
|
|
|
celery_app.conf.update(
|
|
task_serializer="json",
|
|
result_serializer="json",
|
|
accept_content=["json"],
|
|
timezone="Europe/Moscow",
|
|
enable_utc=True,
|
|
task_track_started=True,
|
|
task_acks_late=True,
|
|
worker_prefetch_multiplier=1,
|
|
broker_connection_retry_on_startup=True,
|
|
task_routes={
|
|
"web.tasks.sync.*": {"queue": "sync"},
|
|
"web.tasks.health.*": {"queue": "health"},
|
|
"web.tasks.catalog.*": {"queue": "default"},
|
|
"web.notifications.tasks.*": {"queue": "notifications"},
|
|
},
|
|
beat_schedule={
|
|
"refresh-catalog": {
|
|
"task": "web.tasks.catalog.refresh_catalog",
|
|
"schedule": timedelta(seconds=settings.CATALOG_REFRESH_INTERVAL_SECONDS),
|
|
},
|
|
"refresh-vk-catalog": {
|
|
"task": "web.tasks.vk_catalog.refresh_vk_catalog",
|
|
"schedule": timedelta(seconds=settings.CATALOG_REFRESH_INTERVAL_SECONDS),
|
|
},
|
|
},
|
|
)
|
|
|
|
# Register task modules so beat/worker can discover them
|
|
celery_app.autodiscover_tasks(["web.tasks.catalog", "web.tasks.vk_catalog"])
|