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();
};
if (data->caller_ != nullptr)
{
QObject::connect(worker, &NetworkWorker::doneUrl, data->caller_,
handleReply);
QObject::connect(reply, &QNetworkReply::finished, worker,
[worker]() mutable {
emit worker->doneUrl();
// 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(reply, &QNetworkReply::finished, worker,
// [worker]() mutable {
// emit worker->doneUrl();
delete worker;
});
}
else
{
// delete worker;
// });
// }
// else
// {
QObject::connect(reply, &QNetworkReply::finished, worker,
[handleReply, worker]() mutable {
handleReply();
delete worker;
});
}
// }
};
QObject::connect(&requester, &NetworkRequester::requestUrl, worker,

View file

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

View file

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