mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 00:40:06 +02:00
cleanup to use script-driven cache cleaning
This commit is contained in:
parent
e55d4f97b3
commit
8388e1044a
1 changed files with 16 additions and 19 deletions
|
@ -25,10 +25,13 @@ function debug() {
|
||||||
print.apply(null, [].concat.apply(['hrs fixme', version], [].map.call(arguments, JSON.stringify)));
|
print.apply(null, [].concat.apply(['hrs fixme', version], [].map.call(arguments, JSON.stringify)));
|
||||||
}
|
}
|
||||||
|
|
||||||
var emptyishPlace = 'empty';
|
function isNowIn(place) { // true if currently in specified place
|
||||||
var cachePlaces = ['localhost', 'Welcome'];
|
return location.hostname.toLowerCase() === place.toLowerCase();
|
||||||
var isInCachePlace = cachePlaces.indexOf(location.hostname) >= 0;
|
}
|
||||||
var defaultPlace = isInCachePlace ? 'Playa' : location.hostname;
|
|
||||||
|
var cachePlaces = ['dev-Welcome', 'localhost']; // For now, list the lighter weight one first.
|
||||||
|
var isInCachePlace = cachePlaces.some(isNowIn);
|
||||||
|
var defaultPlace = isInCachePlace ? 'dev-Playa' : location.hostname;
|
||||||
var prompt = "domain-check.js version " + version + "\n\nWhat place should we enter?";
|
var prompt = "domain-check.js version " + version + "\n\nWhat place should we enter?";
|
||||||
debug(cachePlaces, isInCachePlace, defaultPlace, prompt);
|
debug(cachePlaces, isInCachePlace, defaultPlace, prompt);
|
||||||
var entryPlace = Window.prompt(prompt, defaultPlace);
|
var entryPlace = Window.prompt(prompt, defaultPlace);
|
||||||
|
@ -114,17 +117,9 @@ function doLoad(place, continuationWithLoadTime) { // Go to place and call conti
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function doit() {
|
debug('go', place);
|
||||||
debug('go', place);
|
location.hostChanged.connect(waitForLoad);
|
||||||
location.hostChanged.connect(waitForLoad);
|
location.handleLookupString(place);
|
||||||
location.handleLookupString(place);
|
|
||||||
}
|
|
||||||
if (location.placename.toLowerCase() === place.toLowerCase()) {
|
|
||||||
location.handleLookupString(emptyishPlace);
|
|
||||||
Script.setTimeout(doit, 1000);
|
|
||||||
} else {
|
|
||||||
doit();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var config = Render.getConfig("Stats");
|
var config = Render.getConfig("Stats");
|
||||||
|
@ -144,6 +139,7 @@ function doRender(continuation) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var TELEPORT_PAUSE = 500;
|
||||||
function maybePrepareCache(continuation) {
|
function maybePrepareCache(continuation) {
|
||||||
var prepareCache = Window.confirm("Prepare cache?\n\n\
|
var prepareCache = Window.confirm("Prepare cache?\n\n\
|
||||||
Should we start with all and only those items cached that are encountered when visiting:\n" + cachePlaces.join(', ') + "\n\
|
Should we start with all and only those items cached that are encountered when visiting:\n" + cachePlaces.join(', ') + "\n\
|
||||||
|
@ -151,8 +147,6 @@ If 'yes', cache will be cleared and we will visit these two, with a turn in each
|
||||||
You would want to say 'no' (and make other preparations) if you were testing these places.");
|
You would want to say 'no' (and make other preparations) if you were testing these places.");
|
||||||
|
|
||||||
if (prepareCache) {
|
if (prepareCache) {
|
||||||
location.handleLookupString(emptyishPlace);
|
|
||||||
Window.alert("Please do menu Edit->Reload Content (Clears all caches) and THEN press 'ok'.");
|
|
||||||
function loadNext() {
|
function loadNext() {
|
||||||
var place = cachePlaces.shift();
|
var place = cachePlaces.shift();
|
||||||
doLoad(place, function (prepTime) {
|
doLoad(place, function (prepTime) {
|
||||||
|
@ -164,9 +158,12 @@ You would want to say 'no' (and make other preparations) if you were testing the
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
loadNext();
|
location.handleLookupString(cachePlaces[cachePlaces.length - 1]);
|
||||||
|
Menu.triggerOption("Reload Content (Clears all caches)");
|
||||||
|
Script.setTimeout(loadNext, TELEPORT_PAUSE);
|
||||||
} else {
|
} else {
|
||||||
continuation();
|
location.handleLookupString(isNowIn(cachePlaces[0]) ? cachePlaces[1] : cachePlaces[0]);
|
||||||
|
Script.setTimeout(continuation, TELEPORT_PAUSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue