Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
python_open_ai
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
haojie
python_open_ai
Commits
2cd4ba0c
Commit
2cd4ba0c
authored
Apr 10, 2023
by
lei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
7cd7c24b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
download_img.py
+6
-5
No files found.
download_img.py
View file @
2cd4ba0c
...
...
@@ -12,9 +12,10 @@ import multiprocessing
class
DownLoad
:
def
__init__
(
self
,
lock
):
def
__init__
(
self
,
lock
,
thisid
):
self
.
key
=
'laravel_database_discord_img_download'
self
.
lock
=
lock
self
.
thisid
=
thisid
self
.
header
=
{
'Accept'
:
'application/json'
,
'Content-Type'
:
'application/json'
,
...
...
@@ -96,12 +97,12 @@ class DownLoad:
await
self
.
task_callback
(
False
,
''
,
task
,
'转存discord图片失败'
)
else
:
time
.
sleep
(
3
)
logger
.
info
(
'
不存在任务,等待3秒'
)
logger
.
info
(
f
'{self.thisid}-
不存在任务,等待3秒'
)
def
process_start
(
lock
):
def
process_start
(
lock
,
thisid
):
loop
=
asyncio
.
get_event_loop
()
keyword
=
DownLoad
(
lock
)
keyword
=
DownLoad
(
lock
,
thisid
)
# 生产
loop
.
run_until_complete
(
keyword
.
on_start
())
...
...
@@ -113,7 +114,7 @@ if __name__ == '__main__':
lock
=
Lock
()
l
=
[]
for
i
in
range
(
5
):
p
=
Process
(
target
=
process_start
,
args
=
(
lock
,))
p
=
Process
(
target
=
process_start
,
args
=
(
lock
,
i
))
p
.
start
()
l
.
append
(
p
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment