mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
re-enabled loading recent messages concurrently
@pajlada please check if the code can stay commented out
This commit is contained in:
parent
6274c05520
commit
18f3a816ed
3 changed files with 25 additions and 24 deletions
|
@ -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
|
||||
{
|
||||
QObject::connect(reply, &QNetworkReply::finished, worker,
|
||||
[handleReply, worker]() mutable {
|
||||
handleReply();
|
||||
// delete worker;
|
||||
// });
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
QObject::connect(reply, &QNetworkReply::finished, worker,
|
||||
[handleReply, worker]() mutable {
|
||||
handleReply();
|
||||
|
||||
delete worker;
|
||||
});
|
||||
}
|
||||
delete worker;
|
||||
});
|
||||
// }
|
||||
};
|
||||
|
||||
QObject::connect(&requester, &NetworkRequester::requestUrl, worker,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue