Commit 75f404d6 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Task: Drop tasks we can't restore a file for

Provided the file has been created

(cherry picked from commit e0ba241f)
Signed-off-by: default avatarHugo Beauzée-Luyssen <hugo@beauzee.fr>
parent a638654b
...@@ -341,7 +341,20 @@ bool Task::restoreLinkedEntities() ...@@ -341,7 +341,20 @@ bool Task::restoreLinkedEntities()
// ie. have we run the MetadataParser service, at least partially // ie. have we run the MetadataParser service, at least partially
std::shared_ptr<File> file; std::shared_ptr<File> file;
if ( m_fileId != 0 ) if ( m_fileId != 0 )
file = File::fetch( m_ml, m_fileId ); {
// Should there be a sporadic failure, let's retry a few times before
// giving up on this file.
file = sqlite::Tools::withRetries( 3, []( MediaLibraryPtr ml, int64_t fileId ) {
return File::fetch( ml, fileId );
}, m_ml, m_fileId );
if ( file == nullptr )
{
LOG_WARN( "Failed to restore file associated to the task. Task will "
"be dropped" );
destroy( m_ml, m_id );
return false;
}
}
// We might re-create tasks without mrl to ease the handling of files on // We might re-create tasks without mrl to ease the handling of files on
// external storage. // external storage.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment