diff --git a/src/libtomahawk/pipeline.cpp b/src/libtomahawk/pipeline.cpp index c3bab44d6..cbd0d47ed 100644 --- a/src/libtomahawk/pipeline.cpp +++ b/src/libtomahawk/pipeline.cpp @@ -188,9 +188,6 @@ Pipeline::reportResults( QID qid, const QList< result_ptr >& results ) if ( decQIDState( q ) == 0 ) { - // All resolvers have reported back their results for this query now - qDebug() << "Finished resolving:" << q->toString() << q->numResults(); - if ( !q->solved() ) q->onResolvingFinished(); @@ -243,45 +240,43 @@ Pipeline::shunt( const query_ptr& q ) qDebug() << Q_FUNC_INFO << q->solved() << q->toString() << q->id(); unsigned int lastweight = 0; unsigned int lasttimeout = 0; - - if ( q->solved() ) - { -// qDebug() << "Query solved, pipeline aborted:" << q->toString() -// << "numresults:" << q->results().length(); - - QList< result_ptr > rl; - reportResults( q->id(), rl ); - return; - } - int thisResolver = 0; - int i = 0; - foreach( Resolver* r, m_resolvers ) + bool dispatched = false; + + if ( !q->resolvingFinished() ) { - i++; - if ( r->weight() >= q->lastPipelineWeight() ) - continue; + int i = 0; + foreach( Resolver* r, m_resolvers ) + { + i++; + if ( r->weight() >= q->lastPipelineWeight() ) + continue; - if ( lastweight == 0 ) - { - lastweight = r->weight(); - lasttimeout = r->timeout(); - //qDebug() << "Shunting into weight" << lastweight << "q:" << q->toString(); - } - if ( lastweight == r->weight() ) - { - // snag the lowest timeout at this weight - if ( r->timeout() < lasttimeout ) + if ( lastweight == 0 ) + { + lastweight = r->weight(); lasttimeout = r->timeout(); + //qDebug() << "Shunting into weight" << lastweight << "q:" << q->toString(); + } + if ( lastweight == r->weight() ) + { + // snag the lowest timeout at this weight + if ( r->timeout() < lasttimeout ) + lasttimeout = r->timeout(); - // resolvers aren't allowed to block in this call: - qDebug() << "Dispatching to resolver" << r->name() << q->toString(); + // resolvers aren't allowed to block in this call: + if ( dispatched ) + incQIDState( q ); - thisResolver = i; - r->resolve( q ); + dispatched = true; + qDebug() << "Dispatching to resolver" << r->name() << q->toString(); + + thisResolver = i; + r->resolve( q ); + } + else + break; } - else - break; } if ( lastweight > 0 ) @@ -290,18 +285,19 @@ Pipeline::shunt( const query_ptr& q ) if ( thisResolver < m_resolvers.count() ) { + qDebug() << "Shunting in" << lasttimeout << "ms, q:" << q->toString(); incQIDState( q ); -// qDebug() << "Shunting in" << lasttimeout << "ms, q:" << q->toString(); new FuncTimeout( lasttimeout, boost::bind( &Pipeline::shunt, this, q ), this ); } } else { - //qDebug() << "Reached end of pipeline for:" << q->toString(); // reached end of pipeline - QList< result_ptr > rl; - reportResults( q->id(), rl ); - return; + qDebug() << "Reached end of pipeline for:" << q->toString(); + + decQIDState( q ); + if ( !q->solved() ) + q->onResolvingFinished(); } shuntNext(); @@ -329,7 +325,7 @@ Pipeline::incQIDState( const Tomahawk::query_ptr& query ) state = m_qidsState.value( query->id() ) + 1; } -// qDebug() << Q_FUNC_INFO << "inserting to qidsstate:" << query->id() << state; + qDebug() << Q_FUNC_INFO << "inserting to qidsstate:" << query->id() << state; m_qidsState.insert( query->id(), state ); return state; @@ -344,12 +340,12 @@ Pipeline::decQIDState( const Tomahawk::query_ptr& query ) int state = m_qidsState.value( query->id() ) - 1; if ( state ) { -// qDebug() << Q_FUNC_INFO << "replacing" << query->id() << state; + qDebug() << Q_FUNC_INFO << "replacing" << query->id() << state; m_qidsState.insert( query->id(), state ); } else { -// qDebug() << Q_FUNC_INFO << "removing" << query->id() << state; + qDebug() << Q_FUNC_INFO << "removing" << query->id() << state; m_qidsState.remove( query->id() ); } diff --git a/thirdparty/jreen b/thirdparty/jreen index 58fb2d4bc..40fd6b0a3 160000 --- a/thirdparty/jreen +++ b/thirdparty/jreen @@ -1 +1 @@ -Subproject commit 58fb2d4bc2abebdf778ca230a84042c7f5694583 +Subproject commit 40fd6b0a3dbc729fdf1db8490848b43d5b1f57f5