支持redirection
This commit is contained in:
parent
ec03f8180e
commit
9537f995a1
1
.env
1
.env
@ -2,6 +2,7 @@ TEMPLATE_DIR=template/
|
|||||||
API_ENDPOINT=https://zhentuai.com/task/v1
|
API_ENDPOINT=https://zhentuai.com/task/v1
|
||||||
ACCESS_KEY=TEST_ACCESS_KEY
|
ACCESS_KEY=TEST_ACCESS_KEY
|
||||||
TEMP_DIR=tmp/
|
TEMP_DIR=tmp/
|
||||||
|
#REDIRECT_TO_URL=https://worker-renderworker-re-kekuflqjxx.cn-shanghai.fcapp.run/
|
||||||
# QSV
|
# QSV
|
||||||
ENCODER_ARGS="-c:v h264_qsv -global_quality 28 -look_ahead 1"
|
ENCODER_ARGS="-c:v h264_qsv -global_quality 28 -look_ahead 1"
|
||||||
# NVENC
|
# NVENC
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
import threading
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
from opentelemetry.trace import Status, StatusCode
|
from opentelemetry.trace import Status, StatusCode
|
||||||
@ -44,6 +45,13 @@ def sync_center():
|
|||||||
tasks = []
|
tasks = []
|
||||||
templates = []
|
templates = []
|
||||||
logger.warning("获取任务失败")
|
logger.warning("获取任务失败")
|
||||||
|
if os.getenv("REDIRECT_TO_URL", False) != False:
|
||||||
|
for task in tasks:
|
||||||
|
_sess = requests.Session()
|
||||||
|
logger.info("重定向任务【%s】至配置的地址:%s", task.get("id"), os.getenv("REDIRECT_TO_URL"))
|
||||||
|
url = f"{os.getenv('REDIRECT_TO_URL')}{task.get('id')}"
|
||||||
|
threading.Thread(target=requests.post, args=(url,)).start()
|
||||||
|
return []
|
||||||
for template in templates:
|
for template in templates:
|
||||||
template_id = template.get('id', '')
|
template_id = template.get('id', '')
|
||||||
if template_id:
|
if template_id:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user