forked from erp-dev/erp
feat: added print-template(test) and sync_mdy_plate_order beat task setting
This commit is contained in:
@@ -63,6 +63,9 @@ MDY_PRODUCT_CATEGORY_ID = env.int('MDY_PRODUCT_CATEGORY_ID', default=1)
|
||||
MDY_SYNC_PAGE_SIZE = env.int('MDY_SYNC_PAGE_SIZE', default=100)
|
||||
MDY_SYNC_MAX_PAGES = env.int('MDY_SYNC_MAX_PAGES', default=2)
|
||||
MDY_SYNC_MAX_RECORDS = env.int('MDY_SYNC_MAX_RECORDS', default=200)
|
||||
# 明道云“开版暂存”同步:每次请求之间的最小间隔(用于限流)
|
||||
# - 0.02 ~ 50 qps(理论值,实际应更保守以预留重试/关联查询)
|
||||
MDY_PLATE_ORDER_SYNC_REQUEST_INTERVAL_SECONDS = env.float('MDY_PLATE_ORDER_SYNC_REQUEST_INTERVAL_SECONDS', default=0.05)
|
||||
|
||||
# Tencent Cloud (TIIA) 配置:用于通过 ImageUrl 上传图片到图库(CreateImage)
|
||||
# 注意:不要把 secret 写死在代码里,建议通过 .env / 环境变量注入。
|
||||
@@ -530,4 +533,20 @@ CELERY_BEAT_SCHEDULE = {
|
||||
'max_records': MDY_SYNC_MAX_RECORDS,
|
||||
},
|
||||
},
|
||||
# 明道云开版:同步到“暂存表”
|
||||
# - 仅在 02:00-08:00 时间窗内持续运行(每 N 分钟触发一次)
|
||||
# - 通过 request_interval_seconds 控制单次任务对明道云 API 的请求节奏,避免超 QPS
|
||||
'mdy_plate_order_staging_sync': {
|
||||
'task': 'api_v1.tasks.sync_mdy_plate_orders',
|
||||
# 02:00 - 07:59(不包含 08:xx)
|
||||
'schedule': crontab(minute='*/2', hour='2-7'),
|
||||
'kwargs': {
|
||||
'page_size': max(1, int(MDY_SYNC_PAGE_SIZE)),
|
||||
'max_pages': max(1, int(MDY_SYNC_MAX_PAGES)),
|
||||
'max_records': max(1, int(MDY_SYNC_MAX_RECORDS)),
|
||||
'with_related': True,
|
||||
'max_related_per_type': 5,
|
||||
'request_interval_seconds': float(MDY_PLATE_ORDER_SYNC_REQUEST_INTERVAL_SECONDS),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user