mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-20 15:59:42 +01:00
* Store last processed dbcmd guid in Source in case a DBSyncConnection dies on us.
This commit is contained in:
parent
d15878555f
commit
bcf84c2b8c
@ -133,6 +133,7 @@ DBSyncConnection::check()
|
||||
return;
|
||||
}
|
||||
|
||||
Q_ASSERT( m_cmds.isEmpty() );
|
||||
m_uscache.clear();
|
||||
m_us.clear();
|
||||
|
||||
@ -143,10 +144,16 @@ DBSyncConnection::check()
|
||||
connect( cmd_us, SIGNAL( done( QVariantMap ) ), SLOT( gotUs( QVariantMap ) ) );
|
||||
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>(cmd_us) );
|
||||
|
||||
Q_ASSERT( m_cmds.isEmpty() );
|
||||
DatabaseCommand_CollectionStats* cmd_them = new DatabaseCommand_CollectionStats( m_source );
|
||||
connect( cmd_them, SIGNAL( done( QVariantMap ) ), SLOT( gotThem( QVariantMap ) ) );
|
||||
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>(cmd_them) );
|
||||
if ( m_source->lastCmdGuid().isEmpty() )
|
||||
{
|
||||
DatabaseCommand_CollectionStats* cmd_them = new DatabaseCommand_CollectionStats( m_source );
|
||||
connect( cmd_them, SIGNAL( done( QVariantMap ) ), SLOT( gotThem( QVariantMap ) ) );
|
||||
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>(cmd_them) );
|
||||
}
|
||||
else
|
||||
{
|
||||
fetchOpsData( m_source->lastCmdGuid() );
|
||||
}
|
||||
|
||||
// restarts idle countdown
|
||||
m_timer.start();
|
||||
@ -267,6 +274,9 @@ DBSyncConnection::executeCommands()
|
||||
if ( !m_cmds.isEmpty() )
|
||||
{
|
||||
QSharedPointer<DatabaseCommand> cmd = m_cmds.takeFirst();
|
||||
if ( !cmd->singletonCmd() )
|
||||
m_source->setLastCmdGuid( cmd->guid() );
|
||||
|
||||
connect( cmd.data(), SIGNAL( finished() ), SLOT( executeCommands() ) );
|
||||
Database::instance()->enqueue( cmd );
|
||||
}
|
||||
|
@ -45,8 +45,6 @@ Source::Source( int id, const QString& username )
|
||||
, m_avatar( 0 )
|
||||
, m_fancyAvatar( 0 )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << id << username;
|
||||
|
||||
m_scrubFriendlyName = qApp->arguments().contains( "--demo" );
|
||||
|
||||
if ( id == 0 )
|
||||
|
@ -102,6 +102,8 @@ public slots:
|
||||
|
||||
private slots:
|
||||
void dbLoaded( unsigned int id, const QString& fname );
|
||||
QString lastCmdGuid() const { return m_lastCmdGuid; }
|
||||
void setLastCmdGuid( const QString& guid ) { m_lastCmdGuid = guid; }
|
||||
|
||||
void setOffline();
|
||||
void setOnline();
|
||||
@ -114,12 +116,15 @@ private slots:
|
||||
private:
|
||||
void reportSocialAttributesChanged();
|
||||
|
||||
bool m_isLocal;
|
||||
bool m_online;
|
||||
QString m_username, m_friendlyname;
|
||||
int m_id;
|
||||
QList< QSharedPointer<Collection> > m_collections;
|
||||
QVariantMap m_stats;
|
||||
QString m_lastCmdGuid;
|
||||
|
||||
bool m_isLocal;
|
||||
bool m_online;
|
||||
QString m_username;
|
||||
QString m_friendlyname;
|
||||
int m_id;
|
||||
bool m_scrubFriendlyName;
|
||||
|
||||
Tomahawk::query_ptr m_currentTrack;
|
||||
|
Loading…
x
Reference in New Issue
Block a user