Skip to content

Discord.gateway warning "Shard ID None heartbeat blocked for more than 10 seconds." #2832

@Vxnku

Description

@Vxnku

I don't understand python and discord bots. This code was written for me, a person who can no longer maintain contact with anyone at all. The error itself:

Loop thread traceback (most recent call last):
  File "C:\.HgBots\HG_bot_roles-main/main.py", line 877, in <module>
    client.run(discord_token)
  File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\discord\client.py", line 860, in run
    asyncio.run(runner())
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1776.0_x64__qbz5n2kfra8p0\Lib\asyncio\runners.py", line 190, in run
    return runner.run(main)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1776.0_x64__qbz5n2kfra8p0\Lib\asyncio\runners.py", line 118, in run
    return self._loop.run_until_complete(task)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1776.0_x64__qbz5n2kfra8p0\Lib\asyncio\base_events.py", line 640, in run_until_complete
    self.run_forever()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1776.0_x64__qbz5n2kfra8p0\Lib\asyncio\windows_events.py", line 321, in run_forever
    super().run_forever()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1776.0_x64__qbz5n2kfra8p0\Lib\asyncio\base_events.py", line 607, in run_forever
    self._run_once()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1776.0_x64__qbz5n2kfra8p0\Lib\asyncio\base_events.py", line 1922, in _run_once
    handle._run()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1776.0_x64__qbz5n2kfra8p0\Lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "C:\.HgBots\HG_bot_roles-main/main.py", line 585, in update_roles
    users_list = addRoles(parsTimeAllUsers())
  File "C:\.HgBots\HG_bot_roles-main/main.py", line 284, in parsTimeAllUsers
    all = getAllTimeAndTimeSplitDay().copy()
  File "C:\.HgBots\HG_bot_roles-main/main.py", line 306, in getAllTimeAndTimeSplitDay
    users = copy.deepcopy(getDailyOnTime(f"/plugins/OnTime/{date} DailyReport.txt"))
  File "C:\.HgBots\HG_bot_roles-main/main.py", line 357, in getDailyOnTime
    table = treadingWaiting(8, getSFTPfile, patch)
  File "C:\.HgBots\HG_bot_roles-main/main.py", line 246, in treadingWaiting
    t.join(time_sleep)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1776.0_x64__qbz5n2kfra8p0\Lib\threading.py", line 1123, in join
    self._wait_for_tstate_lock(timeout=max(timeout, 0))
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1776.0_x64__qbz5n2kfra8p0\Lib\threading.py", line 1139, in _wait_for_tstate_lock
    if lock.acquire(block, timeout):

The code itself, I can remove part of it when clearing tokens and links to my SFTP:

https://pastebin.com/2pczxXJt

I tried to contact ChatGPT, each time it gave a different problem, either a problem with threads or with optimization. I can assume that Discord has just updated the requirements for asynchronous tasks for bots, I am not capable and do not know how to solve the problem on my own, so I am asking for help, sorry. After referring to similar posts, I don’t understand what to do and how to apply the instructions from them, sorry

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions