feat: per-task on/off switches on /sync page for staged rollout

Adds evo_mirror_enabled and vk_mirror_enabled flags to SyncConfig.
Each of the three background tasks (Зеркало Эвотор / Зеркало ВК /
Синхронизация) can now be enabled independently from the /sync page.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
mguschin
2026-05-12 23:32:02 +03:00
parent 5c2b501749
commit 75b3872170
6 changed files with 94 additions and 19 deletions

View File

@@ -10,7 +10,7 @@ from celery import shared_task
import web.lib.api_logger as api_logger
from web.config import settings
from web.database import SessionLocal
from web.models.connections import VkCachedAlbum, VkCachedProduct, VkConnection
from web.models.connections import SyncConfig, VkCachedAlbum, VkCachedProduct, VkConnection
logger = logging.getLogger(__name__)
@@ -172,6 +172,9 @@ def refresh_vk_catalog(self) -> dict:
.all()
)
for conn in connections:
cfg = db.query(SyncConfig).filter_by(user_id=conn.user_id).first()
if not cfg or not cfg.vk_mirror_enabled:
continue
try:
_sync_user(db, conn.user_id, conn.access_token, conn.vk_user_id)
results["ok"] += 1