diff --git a/src/libtomahawk/network/DbSyncConnection.cpp b/src/libtomahawk/network/DbSyncConnection.cpp index 242787946..7aa9745ad 100644 --- a/src/libtomahawk/network/DbSyncConnection.cpp +++ b/src/libtomahawk/network/DbSyncConnection.cpp @@ -47,6 +47,7 @@ DBSyncConnection::DBSyncConnection( Servent* s, const source_ptr& src ) : Connection( s ) , m_source( src ) , m_state( UNKNOWN ) + , m_fetchCount( 0 ) { qDebug() << Q_FUNC_INFO << src->id() << thread(); @@ -127,6 +128,7 @@ DBSyncConnection::check() if ( m_source->lastCmdGuid().isEmpty() ) { + tDebug() << "Fetching lastCmdGuid from database!"; DatabaseCommand_CollectionStats* cmd_them = new DatabaseCommand_CollectionStats( m_source ); connect( cmd_them, SIGNAL( done( QVariantMap ) ), SLOT( gotThem( QVariantMap ) ) ); Database::instance()->enqueue( QSharedPointer(cmd_them) ); @@ -225,6 +227,8 @@ DBSyncConnection::handleMsg( msg_ptr msg ) if ( m.value( "method" ).toString() == "fetchops" ) { + ++m_fetchCount; + tDebug() << "Fetching new dbops:" << m["lastop"].toString() << m_fetchCount; m_uscache = m; sendOps(); return; @@ -232,7 +236,7 @@ DBSyncConnection::handleMsg( msg_ptr msg ) if ( m.value( "method" ).toString() == "trigger" ) { - tLog( LOGVERBOSE ) << "Got trigger msg on dbsyncconnection, checking for new stuff."; + tLog() << "Got trigger msg on dbsyncconnection, checking for new stuff."; check(); return; } @@ -255,7 +259,7 @@ DBSyncConnection::lastOpApplied() void DBSyncConnection::sendOps() { - tLog( LOGVERBOSE ) << "Will send peer" << m_source->id() << "all ops since" << m_uscache.value( "lastop" ).toString(); + tLog() << "Will send peer" << m_source->id() << "all ops since" << m_uscache.value( "lastop" ).toString(); source_ptr src = SourceList::instance()->getLocal(); @@ -263,6 +267,8 @@ DBSyncConnection::sendOps() connect( cmd, SIGNAL( done( QString, QString, QList< dbop_ptr > ) ), SLOT( sendOpsData( QString, QString, QList< dbop_ptr > ) ) ); + m_uscache.clear(); + Database::instance()->enqueue( QSharedPointer( cmd ) ); } diff --git a/src/libtomahawk/network/DbSyncConnection.h b/src/libtomahawk/network/DbSyncConnection.h index 67f4ac709..cd175bbca 100644 --- a/src/libtomahawk/network/DbSyncConnection.h +++ b/src/libtomahawk/network/DbSyncConnection.h @@ -78,6 +78,7 @@ private: void synced(); void changeState( State newstate ); + int m_fetchCount; Tomahawk::source_ptr m_source; QVariantMap m_uscache;