1aaae4f9 by 周伟奇

fix sleep time

1 parent f7694cd8
......@@ -185,6 +185,8 @@ class Command(BaseCommand, LoggerMixin):
return img_il_list
def handle(self, *args, **kwargs):
sleep_second = 5
max_sleep_second = 300
while self.switch:
# 从队列获取文件信息
doc_info = self.get_doc_info()
......@@ -192,7 +194,8 @@ class Command(BaseCommand, LoggerMixin):
doc_data_path, excel_path, pdf_path, doc_id = self.pdf_download(doc_info)
# 队列为空时的处理
if pdf_path is None:
time.sleep(10)
time.sleep(sleep_second)
sleep_second = min(max_sleep_second, sleep_second+5)
continue
try:
# PDF文件提取图片
......
......@@ -41,7 +41,7 @@ def url_to_parts(url):
class Redis:
def __init__(self, url, connection_pool=None, max_connections=None, socket_timeout=120,
def __init__(self, url, connection_pool=None, max_connections=10, socket_timeout=120,
retry_on_timeout=None, socket_connect_timeout=None):
self._ConnectionPool = connection_pool
scheme, host, port, _, password, path, query = url_to_parts(url)
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!