+ More thread and delay
This commit is contained in:
parent
278e1a80e7
commit
1b24c0c47a
@ -14,7 +14,7 @@ if not os.path.exists(logs_dir):
|
|||||||
|
|
||||||
# api_url = 'https://api.luckytown888.net'
|
# api_url = 'https://api.luckytown888.net'
|
||||||
api_url = 'http://api-server:3000'
|
api_url = 'http://api-server:3000'
|
||||||
max_threading = 5
|
max_threading = 10
|
||||||
|
|
||||||
def transfer(data: dict, local_logger):
|
def transfer(data: dict, local_logger):
|
||||||
bot = CM_BOT_HAL()
|
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}] {result}")
|
||||||
local_logger.info(f"[Thread-{thread_name}] [Done] {data['f_username']} transfer done!")
|
local_logger.info(f"[Thread-{thread_name}] [Done] {data['f_username']} transfer done!")
|
||||||
del bot
|
del bot
|
||||||
time.sleep(1)
|
time.sleep(10)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
weekday = int(datetime.now().strftime("%w"))
|
weekday = int(datetime.now().strftime("%w"))
|
||||||
hour = int(datetime.now().strftime("%H"))
|
hour = int(datetime.now().strftime("%H"))
|
||||||
minutes = int(datetime.now().strftime("%M"))
|
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__}")
|
local_logger = logging.getLogger(f"{__name__}")
|
||||||
|
|
||||||
# Configure file handler for logging to logs folder
|
# Configure file handler for logging to logs folder
|
||||||
@ -55,4 +55,4 @@ while True:
|
|||||||
with ThreadPoolExecutor(max_workers=max_threading) as executor:
|
with ThreadPoolExecutor(max_workers=max_threading) as executor:
|
||||||
results = list(executor.map(lambda item: transfer(item, local_logger), items))
|
results = list(executor.map(lambda item: transfer(item, local_logger), items))
|
||||||
local_logger.info(f"Completed processing {total_items} transfer items.")
|
local_logger.info(f"Completed processing {total_items} transfer items.")
|
||||||
time.sleep(5 * 60)
|
time.sleep(10 * 60)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user