Skip to content

Commit

Permalink
Revert "retry downloads when reciving empty responce"
Browse files Browse the repository at this point in the history
This reverts commit 97f4b11.
  • Loading branch information
mralext20 committed Sep 20, 2024
1 parent 97f4b11 commit aec71de
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions alexBot/cogs/video_dl.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,6 @@ class Video_DL(Cog):
encode_lock = asyncio.Lock()
mirror_upload_lock = asyncio.Lock()

@staticmethod
async def download_job(each, session):
res = None
while res is None:

res = await session.get(each.url)
if res.content_length == 0:
await asyncio.sleep(0.2)
res = None
return res

@Cog.listener()
async def on_message(self, message: discord.Message, override=False, new_deleter=None):
log.debug("on_message function started")
Expand Down Expand Up @@ -135,12 +124,7 @@ async def on_message(self, message: discord.Message, override=False, new_deleter
log.debug("Status is picker. Downloading the photos.")
if not res.picker:
raise NotAVideo("No pickers found.")
fetch_jobs = []
for each in res.picker:
fetch_jobs.append(self.download_job(each, session))

images = await asyncio.gather(*fetch_jobs)

images = await asyncio.gather(*[session.get(each.url) for each in res.picker])
attachments: List[discord.File] = []
for m, group in enumerate(grouper(images, 10)):
for n, image in enumerate(group):
Expand Down

0 comments on commit aec71de

Please sign in to comment.