Send TS if we have one, only update changed data

This commit is contained in:
Matt Pass
2019-10-02 09:01:52 +01:00
committed by GitHub
parent 3f99e02aac
commit 4a348f806e

View File

@@ -148,13 +148,18 @@ var ICEcoder = {
if (!top.ICEcoder.indexing && !top.ICEcoder.loadingFile && top.ICEcoder.serverQueueItems.length === 0 && top.ICEcoder.openSeconds % 3 == 0) {
top.ICEcoder.indexing = true;
// Get new data
fetch('lib/indexer.php')
var timestampExtra = top.ICEcoder.indexData
? "?timestamp="+top.ICEcoder.indexData.timestamps.indexed+"&csrf="+top.ICEcoder.csrf
: "";
fetch('lib/indexer.php'+timestampExtra)
.then(function(response) {
// Convert to JSON
return response.json();
}).then(function(data) {
top.ICEcoder.indexData = data;
top.ICEcoder.indexing = false;
if (data.timestamps.changed) {
top.ICEcoder.indexData = data;
}
top.ICEcoder.indexing = false;
});
}
},1000);