Skip to content

Commit

Permalink
Imp fix
Browse files Browse the repository at this point in the history
Update asap

Signed-off-by: Dawn India <[email protected]>
  • Loading branch information
Dawn-India committed Oct 12, 2024
1 parent 5d5d694 commit efcef43
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
11 changes: 10 additions & 1 deletion bot/helper/ext_utils/bot_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,16 @@
from ..telegram_helper.bot_commands import BotCommands

COMMAND_USAGE = {}
THREAD_POOL = ThreadPoolExecutor(max_workers=4000)

max_workers = min(
10000,
(
cpu_count()
or 0
) + 4
)
THREAD_POOL = ThreadPoolExecutor(max_workers=max_workers)


class SetInterval:
def __init__(
Expand Down
2 changes: 1 addition & 1 deletion bot/helper/listeners/task_listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ async def on_download_error(self, error, button=None):
if self.mid in task_dict:
del task_dict[self.mid]
count = len(task_dict)
await self.remove_from_same_dir()
await self.remove_from_same_dir()
msg = f"Sorry {self.tag}!\nYour download has been stopped."
msg += f"\n\n<code>Reason </code>: {escape(str(error))}"
msg += f"\n<code>Past </code>: {get_readable_time(time() - self.time)}"
Expand Down
8 changes: 3 additions & 5 deletions bot/helper/telegram_helper/message_utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
from asyncio import (
sleep,
create_task,
)
from asyncio import sleep
from re import match as re_match
from time import time
from datetime import (
Expand All @@ -22,6 +19,7 @@
from bot import (
LOGGER,
bot,
bot_loop,
bot_name,
cached_dict,
config_dict,
Expand Down Expand Up @@ -141,7 +139,7 @@ async def auto_delete():
await delete_message(cmd_message)
if bot_message is not None:
await delete_message(bot_message)
create_task(auto_delete())
bot_loop.create_task(auto_delete())


async def delete_links(message):
Expand Down

0 comments on commit efcef43

Please sign in to comment.