mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-20 15:06:19 -05:00
Fixing bug where new downloads may not refresh without a next_download.
This commit is contained in:
parent
42a9dc4c7b
commit
3bfbaa4c22
3 changed files with 15 additions and 4 deletions
|
|
@ -342,7 +342,6 @@ def test_channel_empty_url_doesnt_conflict(test_client, test_session, test_direc
|
|||
async def test_download_channel_no_refresh(test_session, download_channel, video_download_manager):
|
||||
"""A Channel cannot be downloaded until it has been refreshed."""
|
||||
d = download_channel.get_download()
|
||||
d.next_download = video_download_manager.calculate_next_download(d)
|
||||
test_session.commit()
|
||||
|
||||
def check_refreshed(expected: bool):
|
||||
|
|
@ -359,6 +358,7 @@ async def test_download_channel_no_refresh(test_session, download_channel, video
|
|||
await video_download_manager.wait_for_all_downloads()
|
||||
|
||||
check_refreshed(True)
|
||||
assert d.next_download
|
||||
|
||||
|
||||
def test_channel_post_directory(test_session, test_client, test_directory):
|
||||
|
|
|
|||
|
|
@ -551,8 +551,17 @@ class DownloadManager:
|
|||
"""
|
||||
if self.disabled.is_set():
|
||||
return
|
||||
self.renew_recurring_downloads()
|
||||
self.delete_old_once_downloads()
|
||||
|
||||
try:
|
||||
self.renew_recurring_downloads()
|
||||
except Exception as e:
|
||||
logger.error(f'Unable to renew downloads!', exc_info=e)
|
||||
|
||||
try:
|
||||
self.delete_old_once_downloads()
|
||||
except Exception as e:
|
||||
logger.error(f'Unable to delete old downloads!', exc_info=e)
|
||||
|
||||
await self.queue_downloads()
|
||||
|
||||
async def wait_for_all_downloads(self):
|
||||
|
|
@ -641,6 +650,8 @@ class DownloadManager:
|
|||
recurring = self.get_recurring_downloads(session)
|
||||
renewed = False
|
||||
for download in recurring:
|
||||
# A new download may not have a `next_download`, create it if necessary.
|
||||
download.next_download = download.next_download or self.calculate_next_download(download, session=session)
|
||||
if download.next_download < now_:
|
||||
download.renew()
|
||||
renewed = True
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
__version__ = '0.6.0-beta'
|
||||
__version__ = '0.6.1-beta'
|
||||
|
||||
import subprocess
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue