mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-04-05 00:22:31 +02:00
Merge pull request #299 from theli-ua/pipeline
Mark query as resolved only if got results from all resolvers or all timers expired
This commit is contained in:
commit
7628273d45
@ -539,7 +539,11 @@ Pipeline::timeoutShunt( const query_ptr& q )
|
||||
// are we still waiting for a timeout?
|
||||
if ( d->qidsTimeout.contains( q->id() ) )
|
||||
{
|
||||
decQIDState( q );
|
||||
if ( --d->qidsTimeout[q->id()] == 0 )
|
||||
{
|
||||
d->qidsTimeout.remove( q->id() );
|
||||
setQIDState( q, 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -557,7 +561,7 @@ Pipeline::shunt( const query_ptr& q )
|
||||
|
||||
if ( r )
|
||||
{
|
||||
tLog( LOGVERBOSE ) << "Dispatching to resolver" << r->name() << q->toString() << q->solved() << q->id();
|
||||
tLog( LOGVERBOSE ) << "Dispatching to resolver" << r->name() << r->timeout() << q->toString() << q->solved() << q->id();
|
||||
|
||||
q->setCurrentResolver( r );
|
||||
r->resolve( q );
|
||||
@ -565,7 +569,7 @@ Pipeline::shunt( const query_ptr& q )
|
||||
|
||||
if ( r->timeout() > 0 )
|
||||
{
|
||||
d->qidsTimeout.insert( q->id(), true );
|
||||
d->qidsTimeout[q->id()]++;
|
||||
new FuncTimeout( r->timeout(), std::bind( &Pipeline::timeoutShunt, this, q ), this );
|
||||
}
|
||||
}
|
||||
@ -611,9 +615,6 @@ Pipeline::setQIDState( const Tomahawk::query_ptr& query, int state )
|
||||
Q_D( Pipeline );
|
||||
QMutexLocker lock( &d->mut );
|
||||
|
||||
if ( d->qidsTimeout.contains( query->id() ) )
|
||||
d->qidsTimeout.remove( query->id() );
|
||||
|
||||
if ( state > 0 )
|
||||
{
|
||||
d->qidsState.insert( query->id(), state );
|
||||
|
@ -45,7 +45,7 @@ private:
|
||||
QList< Resolver* > resolvers;
|
||||
QList< QPointer<Tomahawk::ExternalResolver> > scriptResolvers;
|
||||
QList< ResolverFactoryFunc > resolverFactories;
|
||||
QMap< QID, bool > qidsTimeout;
|
||||
QMap< QID, unsigned int > qidsTimeout;
|
||||
QMap< QID, unsigned int > qidsState;
|
||||
QMap< QID, query_ptr > qids;
|
||||
QMap< RID, result_ptr > rids;
|
||||
|
Loading…
x
Reference in New Issue
Block a user