mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:44:02 +02:00
Don't multiply heartbeats
This commit is contained in:
parent
713ddd5cef
commit
a7cc582459
1 changed files with 7 additions and 4 deletions
|
@ -368,13 +368,16 @@
|
|||
};
|
||||
}());
|
||||
|
||||
function sendHeartbeat() {
|
||||
function sendHeartbeat(isOneShot) {
|
||||
Messages.sendMessage(HIFI_RECORDER_CHANNEL, JSON.stringify({
|
||||
playing: Player.isPlaying(),
|
||||
recording: Player.recording(),
|
||||
entity: Entity.id()
|
||||
}));
|
||||
heartbeatTimer = Script.setTimeout(sendHeartbeat, HEARTBEAT_INTERVAL);
|
||||
|
||||
if (!isOneShot) {
|
||||
heartbeatTimer = Script.setTimeout(sendHeartbeat, HEARTBEAT_INTERVAL);
|
||||
}
|
||||
}
|
||||
|
||||
function stopHeartbeat() {
|
||||
|
@ -398,12 +401,12 @@
|
|||
} else {
|
||||
log("Didn't start playing " + message.recording + " because already playing " + Player.recording());
|
||||
}
|
||||
sendHeartbeat();
|
||||
sendHeartbeat(true);
|
||||
break;
|
||||
case PLAYER_COMMAND_STOP:
|
||||
Player.stop();
|
||||
Player.autoPlay(); // There may be another recording to play.
|
||||
sendHeartbeat();
|
||||
sendHeartbeat(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue