From 1b24c0c47a5707f286ea1c945c90cafd1daf94fc Mon Sep 17 00:00:00 2001 From: Wong Yiek Heng Date: Wed, 8 Oct 2025 20:15:22 +0800 Subject: [PATCH] + More thread and delay --- cm_transfer_credit.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cm_transfer_credit.py b/cm_transfer_credit.py index 455e095..7003d63 100644 --- a/cm_transfer_credit.py +++ b/cm_transfer_credit.py @@ -14,7 +14,7 @@ if not os.path.exists(logs_dir): # api_url = 'https://api.luckytown888.net' api_url = 'http://api-server:3000' -max_threading = 5 +max_threading = 10 def transfer(data: dict, local_logger): bot = CM_BOT_HAL() @@ -24,13 +24,13 @@ def transfer(data: dict, local_logger): local_logger.info(f"[Thread-{thread_name}] {result}") local_logger.info(f"[Thread-{thread_name}] [Done] {data['f_username']} transfer done!") del bot - time.sleep(1) + time.sleep(10) while True: weekday = int(datetime.now().strftime("%w")) hour = int(datetime.now().strftime("%H")) minutes = int(datetime.now().strftime("%M")) - if weekday == 1 and (hour >= 6 and hour < 13): + if weekday == 1 and (hour >= 6 and hour < 12): local_logger = logging.getLogger(f"{__name__}") # Configure file handler for logging to logs folder @@ -55,4 +55,4 @@ while True: with ThreadPoolExecutor(max_workers=max_threading) as executor: results = list(executor.map(lambda item: transfer(item, local_logger), items)) local_logger.info(f"Completed processing {total_items} transfer items.") - time.sleep(5 * 60) + time.sleep(10 * 60)