Merge branch 'feature/automatic'

This commit is contained in:
Lei PAN
2022-06-04 09:59:51 +02:00
11 changed files with 442 additions and 50 deletions
+6 -6
View File
@@ -21,7 +21,7 @@ BLANK_URL = "about:blank"
class TlsPlaywright(threading.local):
def __init__(self) -> None:
self.playwright = sync_playwright().start()
print("Create playwright instance in Thread", threading.current_thread().name)
print("创建浏览器实例,线程: ", threading.current_thread().name)
class ResultChecker:
@@ -108,7 +108,7 @@ if __name__ == '__main__':
# get the list
params.oracle_log_sender.send_log(msg="开始检查约会结果", subject=LOG_SUBJECT_EVENT, type=TYPE_EVENT_CHECK_RESULTS)
db_manager = params.firebase_store_manager
# collection = db_manager.get_all_successful_items_for_day("2022-05-14", "landd")
# collection = db_manager.get_successful_item_for_day_by_status("2022-05-17", ResultEnum.ACCEPTED)
collection = db_manager.get_all_successful_items()
count = 0
result_list = []
@@ -116,12 +116,12 @@ if __name__ == '__main__':
reserve_pojo = ReserveResultPojo.from_firestore_dict(appointment.to_dict())
result_list.append(reserve_pojo)
with ThreadPoolExecutor(max_workers=10) as executor:
with ThreadPoolExecutor(max_workers=25) as executor:
for reserve in result_list:
count = count + 1
if reserve.accepted is None or ResultEnum.PENDING.value == reserve.accepted:
if reserve.url != BLANK_URL:
executor.submit(ResultChecker().run, reserve, collection)
if reserve.accepted is None or ResultEnum.ACCEPTED.value == reserve.accepted:
executor.submit(ResultChecker().run, reserve, collection)
else:
print("status is " + reserve.accepted)