Commit 6997c21b authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen
Browse files

Revert "parser: Tolerate late completing tasks after flushing"

This reverts commit 433593c5.
This wasn't enough to fix the problem, as a refresh would:
- Invoke flush, setting the flushed flag to true
- Invoke restore, immediatly setting the flag back to false
parent 7f16ae98
......@@ -45,7 +45,6 @@ Parser::Parser( MediaLibrary* ml, FsHolder* fsHolder )
, m_callback( nullptr )
, m_opScheduled( 0 )
, m_opDone( 0 )
, m_flushed( false )
, m_completionSignaled( false )
{
}
......@@ -70,7 +69,6 @@ void Parser::parse( std::shared_ptr<Task> task )
{
std::lock_guard<compat::Mutex> lock{ m_mutex };
m_opScheduled += 1;
m_flushed = false;
updateStats();
}
m_serviceWorkers[0]->parse( std::move( task ) );
......@@ -135,7 +133,6 @@ void Parser::flush()
std::lock_guard<compat::Mutex> lock{ m_mutex };
m_opDone = 0;
m_opScheduled = 0;
m_flushed = true;
}
void Parser::rescan()
......@@ -160,7 +157,6 @@ void Parser::restore()
{
std::lock_guard<compat::Mutex> lock{ m_mutex };
m_opScheduled += tasks.size();
m_flushed = false;
updateStats();
}
m_serviceWorkers[0]->parse( std::move( tasks ) );
......@@ -203,14 +199,7 @@ void Parser::updateStats()
{
if ( m_callback == nullptr )
return;
if ( m_opScheduled < m_opDone )
{
/* Tolerate completing tasks after a flush */
if ( m_flushed == true )
m_opDone = m_opScheduled;
else
assert( !"Unexpected completed task" );
}
assert( m_opScheduled >= m_opDone );
/*
* We don't want to spam the callback receiver each time we're done parsing
* an item, however we must signal progress when:
......
......@@ -104,7 +104,6 @@ private:
IMediaLibraryCb* m_callback;
uint32_t m_opScheduled;
uint32_t m_opDone;
bool m_flushed; /* Helper flag to handle late completing tasks */
bool m_completionSignaled;
};
......
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