meeb / tubesync

Syncs YouTube channels and playlists to a locally hosted media server
GNU Affero General Public License v3.0
1.96k stars 125 forks source link

Scheduled Tasks Numbers differ #257

Open MatthK opened 2 years ago

MatthK commented 2 years ago

It's not that much of a problem, as it is still working, but I was wondering how to fix it.

On the dashboard, it shows that there are 290 tasks scheduled. When I go to the tasks page, it says there are only 15 scheduled (the number of sources I have).

I have reset the tasks, but that didn't help.

TubeSync version 0.10.0 with yt-dlp version 2022.03.08.2 and FFmpeg version 4.3.3-0+deb11u1.

meeb commented 2 years ago

Interesting, the count is just what's in the tasks table so not entirely sure why the number would be different. I'm likely not going to look into this too much given the tasks system is (relatively imminently) being replaced.

MatthK commented 2 years ago

Understood. I just had a look at the table with the tasks and apart from the 15 expected tasks, all the others have the following content (apart from the changing YT ID:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/background_task/tasks.py", line 43, in bg_runner
    func(*args, **kwargs)
  File "/app/sync/tasks.py", line 227, in download_media_metadata
    metadata = media.index_metadata()
  File "/app/sync/models.py", line 1267, in index_metadata
    return indexer(self.url)
  File "/app/sync/youtube.py", line 60, in get_media_info
    raise YouTubeError(f'Failed to extract_info for "{url}": No metadata was '
sync.youtube.YouTubeError: Failed to extract_info for "https://www.youtube.com/watch?v=btl0knU2CxU": No metadata was returned by youtube-dl, check for error messages in the logs above. This task will be retried later with an exponential backoff.

But yes, it's not really an issue, just a cosmetic detail.

meeb commented 2 years ago

Ah so you have a bunch of failed tasks which have stuck about and are being counted in the total number of tasks but have expired so aren't showing on the tasks queue page as scheduled. Makes sense. I don't think this is actually incorrect as a count, just the tasks page splits tasks out into "running", "scheduled into the future" and "failed" as different counts.

MatthK commented 2 years ago

Ok. Can I delete those manually from the table?

meeb commented 2 years ago

Yes, the worst thing that will happen is a video that didn't download after several retries doesn't get tried again. Delete away.

MatthK commented 2 years ago

Deleted those 274 tasks. Now it looks good. Thanks.

MatthK commented 2 years ago

Ha, that seems to be "self-healing". The 291 tasks are back on the dashboard.

meeb commented 2 years ago

They might break quite a lot but at least they are reliably broken...