reticivis-net / mediaforge

A Discord bot for editing and creating videos, images, GIFs, and more!
GNU General Public License v3.0
81 stars 28 forks source link

Tenor API: asyncio.TimeoutError #216

Closed BandBoxBrawl closed 9 months ago

BandBoxBrawl commented 10 months ago

Describe the bug

Upon attempting a $motivate, the bot attempts to download for five-ish minutes before providing an error, stating: Your command encountered an error due to limited resources on the server.

Traceback

DATETIME:2023-10-27 21:42:38.392034
COMMAND:$motivate Me when dinner ready : ) 
(I'm a hungry boy, this is my pre-dinner celebration dance)
TRACEBACK:
Traceback (most recent call last):
  File "/root/.cache/pypoetry/virtualenvs/mediaforge-HXFskkj--py3.11/lib/python3.11/site-packages/discord/ext/commands/core.py", line 235, in wrapped
    ret = await coro(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mediaforge/src/commands/caption.py", line 30, in motivate
    await process(ctx, processing.ffmpeg.motivate, [["VIDEO", "GIF", "IMAGE"]], caption)
  File "/mediaforge/src/core/process.py", line 151, in process
    raise e
  File "/mediaforge/src/core/process.py", line 62, in process
    urls = await imagesearch(ctx, len(inputs))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mediaforge/src/utils/scandiscord.py", line 78, in imagesearch
    hm = await handlemessagesave(m)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mediaforge/src/utils/scandiscord.py", line 35, in handlemessagesave
    tenor = await fetch(
            ^^^^^^^^^^^^
  File "/mediaforge/src/utils/common.py", line 17, in fetch
    async with session.get(url) as response:
  File "/root/.cache/pypoetry/virtualenvs/mediaforge-HXFskkj--py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1167, in __aenter__
    self._resp = await self._coro
                 ^^^^^^^^^^^^^^^^
  File "/root/.cache/pypoetry/virtualenvs/mediaforge-HXFskkj--py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 493, in _request
    with timer:
  File "/root/.cache/pypoetry/virtualenvs/mediaforge-HXFskkj--py3.11/lib/python3.11/site-packages/aiohttp/helpers.py", line 725, in __exit__
    raise asyncio.TimeoutError from None
TimeoutError

Expected Behavior

No response

Steps To Reproduce

No response

Anything Else

No response

reticivis-net commented 9 months ago

Ok I increased the timeout to 10 minutes, this is a band-aid solution but it should hopefully fix it. I was unable to reproduce the behavior outside of MediaForge even inside it's docker container so i dont think it's my ip being blocked or my code being wrong, i think its just mediaforge being overloaded.

reticivis-net commented 9 months ago

seems to have worked, so ill close this for now. feel free to re-open if the issue happens again