mirror of
https://github.com/geode-sdk/geode.git
synced 2025-04-04 09:11:31 -04:00
im tired
This commit is contained in:
parent
164185621e
commit
c8392e92f5
2 changed files with 20 additions and 10 deletions
|
@ -673,7 +673,10 @@ Result<IndexInstallList> Index::getInstallList(IndexItemHandle item) const {
|
|||
}
|
||||
// recursively add dependencies
|
||||
GEODE_UNWRAP_INTO(auto deps, this->getInstallList(depItem));
|
||||
ranges::push(list.list, deps.list);
|
||||
for (auto& dep : deps.list) {
|
||||
if (ranges::contains(list.list, dep)) continue;
|
||||
list.list.push_back(dep);
|
||||
}
|
||||
}
|
||||
// otherwise user must get this dependency manually from somewhere
|
||||
else {
|
||||
|
@ -745,6 +748,7 @@ void Index::Impl::installNext(size_t index, IndexInstallList const& list) {
|
|||
|
||||
auto item = list.list.at(index);
|
||||
auto tempFile = dirs::getTempDir() / (item->getMetadata().getID() + ".index");
|
||||
log::debug("Installing {}", item->getMetadata().getID());
|
||||
m_runningInstallations[list.target] = web::AsyncWebRequest()
|
||||
.join("install_item_" + item->getMetadata().getID())
|
||||
.fetch(item->getDownloadURL())
|
||||
|
@ -780,12 +784,10 @@ void Index::Impl::installNext(size_t index, IndexInstallList const& list) {
|
|||
|
||||
item->setIsInstalled(true);
|
||||
|
||||
log::debug("Installed {}", item->getMetadata().getID());
|
||||
|
||||
// Install next item in queue
|
||||
// this is in next frame cause otherwise
|
||||
// it seems to deadlock and havent figured out why
|
||||
Loader::get()->queueInMainThread([&]{
|
||||
this->installNext(index + 1, list);
|
||||
});
|
||||
this->installNext(index + 1, list);
|
||||
})
|
||||
.expect([postError, list, item](std::string const& err) {
|
||||
postError(fmt::format(
|
||||
|
|
|
@ -297,9 +297,11 @@ SentAsyncWebRequest::Impl::Impl(SentAsyncWebRequest* self, AsyncWebRequest const
|
|||
return 1;
|
||||
}
|
||||
Loader::get()->queueInMainThread([self = data->self, now, total]() {
|
||||
std::lock_guard _(self->m_mutex);
|
||||
std::unique_lock<std::mutex> l(self->m_mutex);
|
||||
for (auto& prog : self->m_progresses) {
|
||||
l.unlock();
|
||||
prog(*self->m_self, now, total);
|
||||
l.lock();
|
||||
}
|
||||
});
|
||||
return 0;
|
||||
|
@ -327,9 +329,11 @@ SentAsyncWebRequest::Impl::Impl(SentAsyncWebRequest* self, AsyncWebRequest const
|
|||
m_finished = true;
|
||||
|
||||
Loader::get()->queueInMainThread([this, ret]() {
|
||||
std::lock_guard _(m_mutex);
|
||||
std::unique_lock<std::mutex> l(m_mutex);
|
||||
for (auto& then : m_thens) {
|
||||
l.unlock();
|
||||
then(*m_self, ret);
|
||||
l.lock();
|
||||
}
|
||||
std::lock_guard __(RUNNING_REQUESTS_MUTEX);
|
||||
RUNNING_REQUESTS.erase(m_id);
|
||||
|
@ -354,9 +358,11 @@ void SentAsyncWebRequest::Impl::doCancel() {
|
|||
}
|
||||
|
||||
Loader::get()->queueInMainThread([this]() {
|
||||
std::lock_guard _(m_mutex);
|
||||
std::unique_lock<std::mutex> l(m_mutex);
|
||||
for (auto& canc : m_cancelleds) {
|
||||
l.unlock();
|
||||
canc(*m_self);
|
||||
l.lock();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -392,9 +398,11 @@ void SentAsyncWebRequest::Impl::error(std::string const& error, int code) {
|
|||
});
|
||||
Loader::get()->queueInMainThread([this, error, code]() {
|
||||
{
|
||||
std::lock_guard _(m_mutex);
|
||||
std::unique_lock<std::mutex> l(m_mutex);
|
||||
for (auto& expect : m_expects) {
|
||||
l.unlock();
|
||||
expect(error, code);
|
||||
l.lock();
|
||||
}
|
||||
}
|
||||
std::lock_guard _(RUNNING_REQUESTS_MUTEX);
|
||||
|
|
Loading…
Add table
Reference in a new issue