Commit ecd665ab authored by Dennis's avatar Dennis
Browse files

Merge branch 'fix-upload-performance' into 'master'

fix emoji problems and uplaod problems

See merge request !106
parents cf9884ca 8eee9ed9
......@@ -194,10 +194,12 @@ void FileUploader::nextRequest()
mPartialRequests.pop_front();
auto request = mPartialRequests.first();
double diff = request->getProgress() - progress;
if( diff >= 0.05){
uint now = QDateTime::currentDateTime().toTime_t();
if( diff >= 0.05 && now - lastUpdate){
progress = request->getProgress();
qDebug() << "progress is "<< progress;
emit progressChanged( progress );
lastUpdate = now;
}
mServer->sendApiRequest( request, true );
}
......
......@@ -65,6 +65,7 @@ class FileUploader : public QObject
bool mCanceled = 0;
bool mErrorStatus = 0;
double progress = 0;
uint lastUpdate = 0;
signals:
void ufsCreated( const QString &mFileId );
void progressChanged( double progress );
......
......@@ -30,7 +30,6 @@ RocketChatServerData::RocketChatServerData( QString pId, QString pBaseUrl, bool
{
qRegisterMetaType<User>( "User" );
qRegisterMetaType<QList<QSharedPointer<Emoji>>>( "QList<QSharedPointer<Emoji>>" );
connect( this, &RocketChatServerData::destroyed, this, &RocketChatServerData::persistData, Qt::UniqueConnection );
mUnsecureConnection = pUnsecure;
mApiUri = QStringLiteral( "/api/v1" );
......@@ -378,9 +377,6 @@ void RocketChatServerData::onStateChanged( const Qt::ApplicationState &pState )
setUserPresenceStatus( static_cast<int>( RocketChatUser::status::ONLINE ) );
}
if ( pState == Qt::ApplicationState::ApplicationSuspended || pState == Qt::ApplicationState::ApplicationInactive ) {
persistData();
}
}
void RocketChatServerData::createVideoCall( const QString &pRid )
......@@ -2087,13 +2083,6 @@ void RocketChatServerData::addUsersToChannel( const QString &pChannelId, const Q
}
}
void RocketChatServerData::persistData()
{
/* mMessageService->persist();
mChannelService->persist();
mEmojiService->persist();
*/
}
ChannelRepository *RocketChatServerData::getChannels() const
......
......@@ -78,17 +78,6 @@ void EmojiService::persistEmoji( const QSharedPointer<Emoji> &pEmoji )
storage->addCustomEmoji( pEmoji->getIdentifier(), pEmoji->getFilePath(), pEmoji->getHtml(), QStringLiteral( "custom" ), QStringLiteral( "dontcare" ) );
}
void EmojiService::persist()
{
storage->transaction();
auto emojiRepo = server->getEmojiRepo();
for ( const auto &emoji : emojiRepo->getElements() ) {
persistEmoji( emoji );
}
storage->askForcommit();
}
void EmojiService::handleCustomEmojisReceived( EmojiData *data )
{
......
......@@ -53,7 +53,6 @@ class EmojiService
void loadCustomEmojis( std::function<void ( QList<QSharedPointer<Emoji>> )> success );
QList<QSharedPointer<Emoji>> loadEmojisFromDb( void );
void persistEmoji( const QSharedPointer<Emoji> &pEmoji );
void persist();
private:
RocketChatServerData *server;
void handleCustomEmojisReceived( EmojiData *data );
......
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