mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 15:25:35 +08:00
refs #659 Fixed a bug where valid timestamps of unloaded values would be lost when writing a new .rev file.
This commit is contained in:
@@ -322,6 +322,7 @@ namespace BlackMisc
|
||||
LockGuard guard(this);
|
||||
|
||||
m_timestamps.clear();
|
||||
m_originalTimestamps.clear();
|
||||
|
||||
QFile revisionFile(m_basename + "/.rev");
|
||||
if (revisionFile.exists())
|
||||
@@ -335,6 +336,8 @@ namespace BlackMisc
|
||||
auto json = QJsonDocument::fromJson(revisionFile.readAll()).object();
|
||||
if (json.contains("uuid") && json.contains("timestamps"))
|
||||
{
|
||||
m_originalTimestamps = fromJson(json.value("timestamps").toObject());
|
||||
|
||||
QUuid uuid(json.value("uuid").toString());
|
||||
if (uuid == m_uuid && m_admittedQueue.isEmpty())
|
||||
{
|
||||
@@ -344,8 +347,7 @@ namespace BlackMisc
|
||||
if (updateUuid) { m_uuid = uuid; }
|
||||
|
||||
auto timesToLive = fromJson(json.value("ttl").toObject());
|
||||
auto newTimestamps = fromJson(json.value("timestamps").toObject());
|
||||
for (auto it = newTimestamps.cbegin(); it != newTimestamps.cend(); ++it)
|
||||
for (auto it = m_originalTimestamps.cbegin(); it != m_originalTimestamps.cend(); ++it)
|
||||
{
|
||||
auto current = timestamps.value(it.key(), -1);
|
||||
auto ttl = timesToLive.value(it.key(), -1);
|
||||
@@ -406,7 +408,7 @@ namespace BlackMisc
|
||||
}
|
||||
|
||||
m_uuid = CIdentifier().toUuid();
|
||||
auto timestamps = m_timestamps;
|
||||
auto timestamps = m_originalTimestamps;
|
||||
for (auto it = i_timestamps.cbegin(); it != i_timestamps.cend(); ++it)
|
||||
{
|
||||
timestamps.insert(it.key(), it.value());
|
||||
|
||||
@@ -162,6 +162,7 @@ namespace BlackMisc
|
||||
QLockFile m_lockFile { m_basename + "/.lock" };
|
||||
QUuid m_uuid;
|
||||
QMap<QString, qint64> m_timestamps;
|
||||
QMap<QString, qint64> m_originalTimestamps;
|
||||
QMap<QString, qint64> m_timesToLive;
|
||||
QSet<QString> m_pinnedValues;
|
||||
QSet<QString> m_deferredValues;
|
||||
|
||||
Reference in New Issue
Block a user