fix sleep time
Showing
2 changed files
with
5 additions
and
2 deletions
| ... | @@ -185,6 +185,8 @@ class Command(BaseCommand, LoggerMixin): | ... | @@ -185,6 +185,8 @@ class Command(BaseCommand, LoggerMixin): |
| 185 | return img_il_list | 185 | return img_il_list |
| 186 | 186 | ||
| 187 | def handle(self, *args, **kwargs): | 187 | def handle(self, *args, **kwargs): |
| 188 | sleep_second = 5 | ||
| 189 | max_sleep_second = 300 | ||
| 188 | while self.switch: | 190 | while self.switch: |
| 189 | # 从队列获取文件信息 | 191 | # 从队列获取文件信息 |
| 190 | doc_info = self.get_doc_info() | 192 | doc_info = self.get_doc_info() |
| ... | @@ -192,7 +194,8 @@ class Command(BaseCommand, LoggerMixin): | ... | @@ -192,7 +194,8 @@ class Command(BaseCommand, LoggerMixin): |
| 192 | doc_data_path, excel_path, pdf_path, doc_id = self.pdf_download(doc_info) | 194 | doc_data_path, excel_path, pdf_path, doc_id = self.pdf_download(doc_info) |
| 193 | # 队列为空时的处理 | 195 | # 队列为空时的处理 |
| 194 | if pdf_path is None: | 196 | if pdf_path is None: |
| 195 | time.sleep(10) | 197 | time.sleep(sleep_second) |
| 198 | sleep_second = min(max_sleep_second, sleep_second+5) | ||
| 196 | continue | 199 | continue |
| 197 | try: | 200 | try: |
| 198 | # PDF文件提取图片 | 201 | # PDF文件提取图片 | ... | ... |
| ... | @@ -41,7 +41,7 @@ def url_to_parts(url): | ... | @@ -41,7 +41,7 @@ def url_to_parts(url): |
| 41 | 41 | ||
| 42 | class Redis: | 42 | class Redis: |
| 43 | 43 | ||
| 44 | def __init__(self, url, connection_pool=None, max_connections=None, socket_timeout=120, | 44 | def __init__(self, url, connection_pool=None, max_connections=10, socket_timeout=120, |
| 45 | retry_on_timeout=None, socket_connect_timeout=None): | 45 | retry_on_timeout=None, socket_connect_timeout=None): |
| 46 | self._ConnectionPool = connection_pool | 46 | self._ConnectionPool = connection_pool |
| 47 | scheme, host, port, _, password, path, query = url_to_parts(url) | 47 | scheme, host, port, _, password, path, query = url_to_parts(url) | ... | ... |
-
Please register or sign in to post a comment