From 981173317e5c9f11364fdff50dfbfae92edc797d Mon Sep 17 00:00:00 2001 From: Lei PAN Date: Mon, 5 Aug 2024 14:29:44 +0200 Subject: [PATCH] shuffle contacts before send requests --- request_sender_test.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/request_sender_test.py b/request_sender_test.py index 2fe77a2..efb2f75 100644 --- a/request_sender_test.py +++ b/request_sender_test.py @@ -1,5 +1,6 @@ import datetime import logging +import random import sys from threading import Thread @@ -92,6 +93,7 @@ def send_request_for_file_list(file_list: list[str], thread_number: int = 20, da for _file_path in file_list: logger.info("send request for file: " + _file_path) _contact_list = read_contacts(_file_path) + random.shuffle(_contact_list) start_send_requests(thread_number=thread_number, contact_list=_contact_list, data_queue_name=data_queue_name) @@ -102,6 +104,6 @@ if __name__ == '__main__': # '~/Desktop/contact_list_2024-05-21.xlsx', # '~/Desktop/15_05_to_test.xlsx'] # file_list = ['~/Desktop/15_05_to_test.xlsx', '~/Desktop/16_05_to_test.xlsx'] - file_list = ['~/Desktop/contact_list_2024-06-28.xlsx'] - send_request_for_file_list(file_list=file_list, thread_number=10, + file_list = ['~/Desktop/contact_list_2024-07-25.xlsx'] + send_request_for_file_list(file_list=file_list, thread_number=100, data_queue_name=MORNING_DATA_CACHE)