Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
周伟奇
/
bmw-ocr
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
1aaae4f9
authored
2020-06-24 11:08:25 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix sleep time
1 parent
f7694cd8
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
2 deletions
src/apps/doc/management/commands/doc_process.py
src/common/redis_cache/base.py
src/apps/doc/management/commands/doc_process.py
View file @
1aaae4f
...
...
@@ -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文件提取图片
...
...
src/common/redis_cache/base.py
View file @
1aaae4f
...
...
@@ -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
)
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment