re-enabled loading recent messages concurrently

@pajlada please check if the code can stay commented out
This commit is contained in:
fourtf 2019-08-13 14:33:16 +02:00
parent 6274c05520
commit 18f3a816ed
3 changed files with 25 additions and 24 deletions

View file

@ -301,26 +301,27 @@ void NetworkRequest::doRequest()
reply->deleteLater(); reply->deleteLater();
}; };
if (data->caller_ != nullptr) // FOURTF: Not sure what this does but it doesn't work.
{ // if (data->caller_ != nullptr)
QObject::connect(worker, &NetworkWorker::doneUrl, data->caller_, // {
handleReply); // QObject::connect(worker, &NetworkWorker::doneUrl, data->caller_,
QObject::connect(reply, &QNetworkReply::finished, worker, // handleReply);
[worker]() mutable { // QObject::connect(reply, &QNetworkReply::finished, worker,
emit worker->doneUrl(); // [worker]() mutable {
// emit worker->doneUrl();
delete worker; // delete worker;
}); // });
} // }
else // else
{ // {
QObject::connect(reply, &QNetworkReply::finished, worker, QObject::connect(reply, &QNetworkReply::finished, worker,
[handleReply, worker]() mutable { [handleReply, worker]() mutable {
handleReply(); handleReply();
delete worker; delete worker;
}); });
} // }
}; };
QObject::connect(&requester, &NetworkRequester::requestUrl, worker, QObject::connect(&requester, &NetworkRequester::requestUrl, worker,

View file

@ -213,7 +213,7 @@ ImagePtr Image::fromUrl(const Url &url, qreal scale)
} }
else else
{ {
qDebug() << "same image loaded multiple times:" << url.string; // qDebug() << "same image created multiple times:" << url.string;
} }
return shared; return shared;

View file

@ -612,7 +612,7 @@ void TwitchChannel::loadRecentMessages()
Env::get().recentMessagesApiUrl.arg(this->getName())); Env::get().recentMessagesApiUrl.arg(this->getName()));
request.setCaller(QThread::currentThread()); request.setCaller(QThread::currentThread());
// can't be concurrent right now due to SignalVector // can't be concurrent right now due to SignalVector
// request.setExecuteConcurrently(true); request.setExecuteConcurrently(true);
request.onSuccess([weak = weakOf<Channel>(this)](auto result) -> Outcome { request.onSuccess([weak = weakOf<Channel>(this)](auto result) -> Outcome {
auto shared = weak.lock(); auto shared = weak.lock();
@ -635,10 +635,10 @@ void TwitchChannel::loadRecentMessages()
} }
} }
// postToThread( postToThread(
// [shared, messages = std::move(allBuiltMessages)]() mutable { [shared, messages = std::move(allBuiltMessages)]() mutable {
shared->addMessagesAtStart(allBuiltMessages); shared->addMessagesAtStart(messages);
// }); });
return Success; return Success;
}); });