Commit 2cd4ba0c by lei

1

parent 7cd7c24b
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment