sync problem with playwright
This commit is contained in:
+13
-8
@@ -10,7 +10,7 @@ from playwright.sync_api import sync_playwright
|
||||
import params
|
||||
from workers.commandor_page import get_random_id_number_for_proxy
|
||||
from logs.LogSender import TYPE_EVENT_CHECK_RESULTS, LOG_SUBJECT_EVENT
|
||||
from pojo.ReserveResultPojo import ReserveResultPojo
|
||||
from pojo.ReserveResultPojo import ReserveResultPojo, PublishType
|
||||
|
||||
SORRY_SENTENCE = "nous sommes sincèrement désolés de n'avoir pu vous satisfaire cette fois-ci"
|
||||
PENDING_SENTENCE = "Ce soir, entre 20:00 et 20:30, vous obtiendrez une réponse par e-mail."
|
||||
@@ -106,13 +106,18 @@ if __name__ == '__main__':
|
||||
db_manager = params.firebase_store_manager
|
||||
collection = db_manager.get_all_successful_items()
|
||||
count = 0
|
||||
task_list = list()
|
||||
result_pojo = ReserveResultPojo(type=PublishType.SUCCESS, phone="0649614591", email="panleicim@gmail.com",
|
||||
message="SUCCESS", firstName="Lei", lastName="PAN")
|
||||
result_list = []
|
||||
for appointment in collection.stream():
|
||||
reserve_pojo = ReserveResultPojo.from_firestore_dict(appointment.to_dict())
|
||||
result_list.append(result_pojo)
|
||||
|
||||
with ThreadPoolExecutor(max_workers=2) as executor:
|
||||
for appointment in collection.stream():
|
||||
for reserve in result_list:
|
||||
count = count + 1
|
||||
reserve_pojo = ReserveResultPojo.from_firestore_dict(appointment.to_dict())
|
||||
if reserve_pojo.accepted:
|
||||
print("status is " + reserve_pojo.accepted)
|
||||
if reserve_pojo.accepted is None or ResultEnum.PENDING.value == reserve_pojo.accepted:
|
||||
executor.submit(Worker().run, threading.Event(), reserve_pojo, collection)
|
||||
if reserve.accepted:
|
||||
print("status is " + reserve.accepted)
|
||||
if reserve.accepted is None or ResultEnum.PENDING.value == reserve.accepted:
|
||||
executor.submit(Worker().run, reserve, collection)
|
||||
print(count)
|
||||
|
||||
Reference in New Issue
Block a user