do not read email for successful requests

This commit is contained in:
2024-03-29 16:03:42 +01:00
parent e08483fe94
commit 5dd90359a2
9 changed files with 171 additions and 17 deletions
+8 -2
View File
@@ -26,12 +26,18 @@ def is_already_sent(contact: ContactPojo) -> bool:
def filter_contacts(_contact_list: list) -> list:
already_sent_contacts = MONGO_STORE_MANAGER.get_all_successful_items_for_day()
_link_to_validate_list = MONGO_STORE_MANAGER.get_links_to_validate()
_contact_list_to_book = []
for contact in _contact_list:
_to_add = True
for booked in already_sent_contacts:
if contact.mail == booked.email:
_to_add = False
#如果已经收到链接了,就不要再请求
for link_to_validate in _link_to_validate_list:
if contact.mail == link_to_validate.email:
logger.info("{}: link already received".format(contact.mail))
_to_add = False
if _to_add:
_contact_list_to_book.append(contact)
@@ -64,10 +70,10 @@ def send_appointment_request(message_queue_name, _contact_list):
if __name__ == '__main__':
contacts_file_path = '~/Desktop/contact_list_2024-03-26-2.xlsx'
contacts_file_path = '~/Desktop/contact_list_2024-03-25.xlsx'
_contact_list = read_contacts(contacts_file_path)
_contact_list_to_book = filter_contacts(_contact_list)
_segment_number = 5
_segment_number = 2
logger.info("{} contacts to book".format(len(_contact_list_to_book)))
last_thread = None
for i in range(0, _segment_number):