Improve speed of starting playing animations at server start-up

This commit is contained in:
David Rowe 2017-04-15 13:20:42 +12:00
parent e91cf4a4e8
commit ef8f36026c

View file

@ -279,8 +279,11 @@
} }
function autoPlay() { function autoPlay() {
var recording; var recording,
AUTOPLAY_SEARCH_DELTA = 1000; // TODO: Final value.
// Random delay to help reduce collisions between AC scripts.
Script.setTimeout(function () {
recording = Entity.find(); recording = Entity.find();
if (recording) { if (recording) {
log("Play persisted recording " + recordingFilename); log("Play persisted recording " + recordingFilename);
@ -288,6 +291,7 @@
} else { } else {
autoPlayTimer = Script.setTimeout(autoPlay, AUTOPLAY_SEARCH_INTERVAL); // Try again soon. autoPlayTimer = Script.setTimeout(autoPlay, AUTOPLAY_SEARCH_INTERVAL); // Try again soon.
} }
}, Math.random() * AUTOPLAY_SEARCH_DELTA);
} }
playRecording = function (recording, position, orientation) { playRecording = function (recording, position, orientation) {