forked from janeczku/calibre-web
-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent stuck videos from carrying over to next download session ["unavailable fragments" ?] #193
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
4731503
Prevent stuck videos from carrying over next download session
deldesir 106bc84
Commit changes made in database
deldesir 6bf33f1
Ensure the right id is used to remove failed video captions
deldesir 0f9d435
Delete only if no error found
deldesir 2992049
Remove unnecessary close connection
deldesir fefdbff
Close the database connection
deldesir 59e671e
Remove unnecessary connection commit
deldesir 5d604e6
Enhance status message
deldesir 1855e33
Enhance log message
deldesir b482073
Remove one more unnecessary commit
deldesir File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is one record with this webpath guaranteed to exist in the media table, even when the query at line 89 returned no records?
Since the query above has the extra condition
... AND path NOT LIKE 'http%'
, it's possible that this less restrictive query might return one result (or more?).If the query fails, trying to access field
[0]
will throw, and you may need to add an extra check:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure I understand your point well. I am confident one record with this
webpath
will always be present because it's in fact "the" trigger of the actual download task. It's mandatory. However the conditionAND path NOT LIKE 'http%'
might not be met under certain circumstances, i.e when the video fails to have itpath
updated with a path.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reviewed how the media table is created and updated by xklb, and it seems that a record with
webpath = media_url
will be inserted by thelb dl
child process at some point...Could there be cases where the child process fails before updating the database?
If it's possible (even if rare), then this query will return 0 records, and this code should defensively check before trying to access the result.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The running of the child process alone attests the existence of
webpath = media_url
. Yes there are cases wherelb dl
can fail, for example live videos, videos without an available/suitable format, videos stuck due to unavailable fragments or network issues. But it will never return 0 record because it's "metadata fetch" that creates the record exists and ensures this specific record is used percalibre-web/scripts/lb-wrapper
Line 84 in b854132