commit 5184222cc501420e50d15d6dda1a6e0d19d87e1d
parent be1a2db3eb5990d3fed3609bb8e7da6e42eaa769
Author: cfillion <cfillion@users.noreply.github.com>
Date: Mon, 23 Oct 2017 02:32:26 -0400
browser: fix Refresh Browser (F5) action (v1.2rc1 regression)
Diffstat:
3 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/src/synchronize.cpp b/src/synchronize.cpp
@@ -24,10 +24,10 @@
#include "reapack.hpp"
#include "transaction.hpp"
-SynchronizeTask::SynchronizeTask(const Remote &remote, const bool fullSync,
- const InstallOpts &opts, Transaction *tx)
+SynchronizeTask::SynchronizeTask(const Remote &remote, const bool stale,
+ const bool fullSync, const InstallOpts &opts, Transaction *tx)
: Task(tx), m_remote(remote), m_indexPath(Index::pathFor(m_remote.name())),
- m_opts(opts), m_fullSync(fullSync)
+ m_opts(opts), m_stale(stale), m_fullSync(fullSync)
{
}
@@ -39,7 +39,7 @@ bool SynchronizeTask::start()
FS::mtime(m_indexPath, &mtime);
const time_t threshold = netConfig.staleThreshold;
- if(!m_fullSync && mtime && (!threshold || mtime > now - threshold))
+ if(!m_stale && mtime && (!threshold || mtime > now - threshold))
return true;
auto dl = new FileDownload(m_indexPath, m_remote.url(),
diff --git a/src/task.hpp b/src/task.hpp
@@ -59,7 +59,8 @@ private:
class SynchronizeTask : public Task {
public:
- SynchronizeTask(const Remote &remote, bool fullSync,
+ // TODO: remove InstallOpts argument
+ SynchronizeTask(const Remote &remote, bool stale, bool fullSync,
const InstallOpts &, Transaction *);
protected:
@@ -72,6 +73,7 @@ private:
Remote m_remote;
Path m_indexPath;
InstallOpts m_opts;
+ bool m_stale;
bool m_fullSync;
};
diff --git a/src/transaction.cpp b/src/transaction.cpp
@@ -60,13 +60,13 @@ void Transaction::synchronize(const Remote &remote,
InstallOpts opts = g_reapack->config()->install;
opts.autoInstall = remote.autoInstall(forceAutoInstall.value_or(opts.autoInstall));
- m_nextQueue.push(make_shared<SynchronizeTask>(remote, true, opts, this));
+ m_nextQueue.push(make_shared<SynchronizeTask>(remote, true, true, opts, this));
}
void Transaction::fetchIndexes(const vector<Remote> &remotes, const bool stale)
{
for(const Remote &remote : remotes)
- m_nextQueue.push(make_shared<SynchronizeTask>(remote, false, InstallOpts{}, this));
+ m_nextQueue.push(make_shared<SynchronizeTask>(remote, stale, false, InstallOpts{}, this));
}
vector<IndexPtr> Transaction::getIndexes(const vector<Remote> &remotes) const