Skip to content

Commit

Permalink
add some sleeps
Browse files Browse the repository at this point in the history
  • Loading branch information
datawhores committed Mar 11, 2024
1 parent e934325 commit d9a8a7a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ofscraper/download/alt_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ async def alt_download_downloader(item, c, ele, progress):
item, c, ele, placeholderObj, progress
)
except OSError as E:
await asyncio.sleep(1)
common_globals.log.debug(
f"{get_medialog(ele)} [attempt {_attempt.get()}/{constants.getattr('DOWNLOAD_RETRIES')}] Number of Open Files -> { len(psutil.Process().open_files())}"
)
Expand All @@ -214,6 +215,7 @@ async def alt_download_downloader(item, c, ele, progress):
)
raise E
except Exception as E:
await asyncio.sleep(1)
common_globals.log.traceback_(
f"{get_medialog(ele)} [attempt {_attempt.get()}/{constants.getattr('DOWNLOAD_RETRIES')}] {traceback.format_exc()}"
)
Expand Down
2 changes: 2 additions & 0 deletions ofscraper/download/alt_downloadbatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ async def alt_download_downloader(
else:
return await alt_data_handler(item, c, ele, placeholderObj)
except OSError as E:
await asyncio.sleep(1)
common_globals.log.debug(
f"{get_medialog(ele)} [attempt {_attempt.get()}/{constants.getattr('DOWNLOAD_RETRIES')}] Number of open Files across all processes-> {len(system.getOpenFiles(unique=False))}"
)
Expand All @@ -209,6 +210,7 @@ async def alt_download_downloader(
)
raise E
except Exception as E:
await asyncio.sleep(1)
common_globals.innerlog.get().traceback_(
f"{get_medialog(ele)} [attempt {_attempt.get()}/{constants.getattr('DOWNLOAD_RETRIES')}] {traceback.format_exc()}"
)
Expand Down
2 changes: 2 additions & 0 deletions ofscraper/download/main_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ async def main_download_downloader(c, ele, progress):
else:
return await alt_data_handler(c, tempholderObj, ele, progress)
except OSError as E:
await asyncio.sleep(1)
common_globals.log.debug(
f"[attempt {common_globals.attempt.get()}/{constants.getattr('DOWNLOAD_RETRIES')}] Number of Open Files -> { len(psutil.Process().open_files())}"
)
Expand All @@ -162,6 +163,7 @@ async def main_download_downloader(c, ele, progress):
)
raise E
except Exception as E:
await asyncio.sleep(1)
common_globals.log.traceback_(
f"{get_medialog(ele)} [attempt {common_globals.attempt.get()}/{constants.getattr('DOWNLOAD_RETRIES')}] {traceback.format_exc()}"
)
Expand Down
2 changes: 2 additions & 0 deletions ofscraper/download/main_downloadbatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ async def main_download_downloader(c, ele):
return await alt_data_handler(c, ele, tempholderObj)

except OSError as E:
await asyncio.sleep(1)
common_globals.innerlog.get().debug(
f"{get_medialog(ele)} [attempt {common_globals.attempt.get()}/{constants.getattr('DOWNLOAD_RETRIES')}] Number of open Files across all processes-> {len(system.getOpenFiles(unique=False))}"
)
Expand All @@ -161,6 +162,7 @@ async def main_download_downloader(c, ele):
)
raise E
except Exception as E:
await asyncio.sleep(1)
common_globals.innerlog.get().traceback_(
f"{get_medialog(ele)} [attempt {common_globals.attempt.get()}/{constants.getattr('DOWNLOAD_RETRIES')}] {traceback.format_exc()}"
)
Expand Down

0 comments on commit d9a8a7a

Please sign in to comment.