changes per CR

This commit is contained in:
humbletim 2020-10-31 13:50:47 -04:00
parent a7fb294a1b
commit f41ef31ef5

View file

@ -87,8 +87,8 @@ void ScriptCache::getScriptContents(const QString& scriptOrURL, contentAvailable
if (_scriptCache.contains(url) && !forceDownload) { if (_scriptCache.contains(url) && !forceDownload) {
auto entry = _scriptCache[url]; auto entry = _scriptCache[url];
if (url.isLocalFile() || url.scheme().isEmpty()) { if (url.isLocalFile() || url.scheme().isEmpty()) {
auto mtime = QFileInfo(url.toLocalFile()).lastModified(); auto modifiedTime = QFileInfo(url.toLocalFile()).lastModified();
QString localTime = ResourceRequest::toHttpDateString(mtime.toMSecsSinceEpoch()); QString localTime = ResourceRequest::toHttpDateString(modifiedTime.toMSecsSinceEpoch());
QString cachedTime = entry["last-modified"].toString(); QString cachedTime = entry["last-modified"].toString();
if (cachedTime != localTime) { if (cachedTime != localTime) {
forceDownload = true; forceDownload = true;
@ -97,10 +97,10 @@ void ScriptCache::getScriptContents(const QString& scriptOrURL, contentAvailable
} }
} }
if (!forceDownload) { if (!forceDownload) {
lock.unlock(); lock.unlock();
qCDebug(scriptengine) << "Found script in cache:" << url.fileName(); qCDebug(scriptengine) << "Found script in cache:" << url.fileName();
contentAvailable(url.toString(), entry["data"].toString(), true, true, STATUS_CACHED); contentAvailable(url.toString(), entry["data"].toString(), true, true, STATUS_CACHED);
return; return;
} }
} }
{ {
@ -155,8 +155,8 @@ void ScriptCache::scriptContentAvailable(int maxRetries) {
_activeScriptRequests.remove(url); _activeScriptRequests.remove(url);
_scriptCache[url] = { _scriptCache[url] = {
{ "data", scriptContent = req->getData() }, { "data", scriptContent = req->getData() },
{ "last-modified", req->property("last-modified") }, { "last-modified", req->property("last-modified") },
}; };
} else { } else {
auto result = req->getResult(); auto result = req->getResult();