Commit 360f3219 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen
Browse files

Parser: Don't account for linking tasks in stats

Fix #415
parent c5d3a160
Pipeline #203148 passed with stages
in 7 minutes and 15 seconds
......@@ -28,6 +28,7 @@
#include <utility>
#include <cassert>
#include <algorithm>
#include "MediaLibrary.h"
#include "ParserWorker.h"
......@@ -67,6 +68,7 @@ void Parser::parse( std::shared_ptr<Task> task )
if ( m_serviceWorkers.empty() == true )
return;
assert( task != nullptr );
if ( task->isLinkTask() == false )
{
std::lock_guard<compat::Mutex> lock{ m_mutex };
m_opScheduled += 1;
......@@ -156,10 +158,14 @@ void Parser::restore()
LOG_DEBUG( "No task to resume." );
return;
}
auto nbTasks = std::count_if( cbegin( tasks ), cend( tasks ),
[]( const std::shared_ptr<Task>& t ) {
return t->isLinkTask() == false;
});
LOG_INFO( "Resuming parsing on ", tasks.size(), " tasks" );
{
std::lock_guard<compat::Mutex> lock{ m_mutex };
m_opScheduled += tasks.size();
m_opScheduled += nbTasks;
m_flushed = false;
updateStats();
}
......@@ -237,6 +243,7 @@ void Parser::done( std::shared_ptr<Task> t, Status status )
status == Status::Discarded ||
t->isCompleted() )
{
if ( t->isLinkTask() == false )
{
std::lock_guard<compat::Mutex> lock{ m_mutex };
++m_opDone;
......@@ -259,9 +266,12 @@ void Parser::done( std::shared_ptr<Task> t, Status status )
// forever.
if ( t->attemptsRemaining() == 0 )
{
std::lock_guard<compat::Mutex> lock{ m_mutex };
++m_opDone;
updateStats();
if ( t->isLinkTask() == false )
{
std::lock_guard<compat::Mutex> lock{ m_mutex };
++m_opDone;
updateStats();
}
return;
}
t->resetCurrentService();
......
Supports Markdown
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