Skip to content

Commit

Permalink
fix freeze in handle_cancel_all function
Browse files Browse the repository at this point in the history
  • Loading branch information
houshmand-2005 committed Jul 24, 2024
1 parent 2bd39b6 commit 1b145f4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
19 changes: 9 additions & 10 deletions utils/get_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,24 +174,23 @@ async def handle_cancel_all(tasks: list[Task], panel_data: PanelType) -> None:
tasks (list[Task]): The list of tasks to be cancelled.
"""
# pylint: disable=duplicate-code
while True:
await asyncio.sleep(8192) # =~ 2 hours and 27 minutes
for task in tasks:
print(f"Cancelling {task.get_name()}...")
task.cancel()
tasks.remove(task)
await get_nodes(panel_data)
async with asyncio.TaskGroup() as tg:
async with asyncio.TaskGroup() as tg:
while True:
await asyncio.sleep(8192) # =~ 2 hours and 27 minutes
for task in tasks:
print(f"Cancelling {task.get_name()}...")
task.cancel()
tasks.remove(task)
print("Start Create Panel Task Test: ")
await create_panel_task(panel_data, tg)
await asyncio.sleep(2)
await asyncio.sleep(5)
nodes_list = await get_nodes(panel_data)
if nodes_list and not isinstance(nodes_list, ValueError):
print("Start Create Nodes Task Test: ")
for node in nodes_list:
if node.status == "connected":
await create_node_task(panel_data, tg, node)
await asyncio.sleep(2)
await asyncio.sleep(3)


async def check_and_add_new_nodes(panel_data: PanelType, tg: asyncio.TaskGroup) -> None:
Expand Down
2 changes: 1 addition & 1 deletion v2iplimit.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from utils.read_config import read_config
from utils.types import PanelType

VERSION = "1.0.6.1"
VERSION = "1.0.6"

parser = argparse.ArgumentParser(description="Help message")
parser.add_argument("--version", action="version", version=VERSION)
Expand Down

0 comments on commit 1b145f4

Please sign in to comment.