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:
@@ -215,6 +215,9 @@ def refresh_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.evo_mirror_enabled:
|
||||
continue
|
||||
try:
|
||||
_sync_user(db, conn.user_id, conn.access_token)
|
||||
results["ok"] += 1
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user