Load distribution in refresh provision

This commit is contained in:
Zaid Abdulla committed 2017-01-03 18:58:57 -08:00
1 parent 7620628e52
commit 4b5dc25010
2 files changed
+11 -1

No files matched your search

+2 -1
View File
@@ -29,7 +29,8 @@ function refresh(sessionData, provision, declarations, startRevision, endRevisio
path.length = MAX_DEPTH;
path.fill("*", l);
let every = 1000 * (provision[2] || 1);
let t = Math.trunc(sessionData.timestamp / every) * every;
let offset = Math.abs(common.djb2(sessionData.deviceId)) % 86400000;
let t = Math.trunc((sessionData.timestamp + offset) / every) * every - offset;
for (let i = l; i < path.length; ++ i)
declarations.push([path.slice(0, i), t, {object: 1, writable: 1, value: t}]);