shuffle contacts before send requests
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import datetime
|
import datetime
|
||||||
import logging
|
import logging
|
||||||
|
import random
|
||||||
import sys
|
import sys
|
||||||
from threading import Thread
|
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:
|
for _file_path in file_list:
|
||||||
logger.info("send request for file: " + _file_path)
|
logger.info("send request for file: " + _file_path)
|
||||||
_contact_list = read_contacts(_file_path)
|
_contact_list = read_contacts(_file_path)
|
||||||
|
random.shuffle(_contact_list)
|
||||||
start_send_requests(thread_number=thread_number, contact_list=_contact_list,
|
start_send_requests(thread_number=thread_number, contact_list=_contact_list,
|
||||||
data_queue_name=data_queue_name)
|
data_queue_name=data_queue_name)
|
||||||
|
|
||||||
@@ -102,6 +104,6 @@ if __name__ == '__main__':
|
|||||||
# '~/Desktop/contact_list_2024-05-21.xlsx',
|
# '~/Desktop/contact_list_2024-05-21.xlsx',
|
||||||
# '~/Desktop/15_05_to_test.xlsx']
|
# '~/Desktop/15_05_to_test.xlsx']
|
||||||
# file_list = ['~/Desktop/15_05_to_test.xlsx', '~/Desktop/16_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']
|
file_list = ['~/Desktop/contact_list_2024-07-25.xlsx']
|
||||||
send_request_for_file_list(file_list=file_list, thread_number=10,
|
send_request_for_file_list(file_list=file_list, thread_number=100,
|
||||||
data_queue_name=MORNING_DATA_CACHE)
|
data_queue_name=MORNING_DATA_CACHE)
|
||||||
|
|||||||
Reference in New Issue
Block a user