代码优化
This commit is contained in:
parent
10e8d1d4e9
commit
cde87999f7
|
|
@ -35,3 +35,5 @@ class DataReceive(BaseModel):
|
|||
|
||||
class DeviceResetData(BaseModel):
|
||||
device_id: str = Field(..., description="设备ID")
|
||||
country: str = Field(..., description="国家")
|
||||
app_name: str = Field(..., description="应用名称")
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class AllTask:
|
|||
# 任务结束后开始等待
|
||||
endtime = time.time() + 55
|
||||
while time.time() < endtime:
|
||||
await time.sleep(1)
|
||||
await time.sleep(5)
|
||||
result = self.redis_conn.read_data(key)
|
||||
if result:
|
||||
return result
|
||||
|
|
@ -62,8 +62,7 @@ class AllTask:
|
|||
await self.db_pool.insert_many(table="crawler_task_record_info", data=param)
|
||||
except Exception as e:
|
||||
print("将任务记录到数据库失败,失败原因为:{}".format(e))
|
||||
result = []
|
||||
if param["app_name"] == "Shopee":
|
||||
result = await self.deal_shopee_task(data)
|
||||
if result:
|
||||
return result
|
||||
return None
|
||||
|
|
|
|||
Loading…
Reference in New Issue