Skip to content

Commit

Permalink
refactor: check isMirroring in new file event
Browse files Browse the repository at this point in the history
  • Loading branch information
NikhilNarayana committed Jul 7, 2021
1 parent 6e89141 commit 0a8f594
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/console/mirrorManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ export class MirrorManager {

const fileWriter = new SlpFileWriter({ folderPath: config.folderPath, consoleNickname: "unknown" });
fileWriter.on(SlpFileWriterEvent.NEW_FILE, (currFilePath) => {
this._playFile(currFilePath, config.ipAddress).catch(log.warn);
if (this.mirrors[config.ipAddress].isMirroring) {
this._playFile(currFilePath, config.ipAddress).catch(log.warn);
}

// Let the front-end know of the new file that we're writing too
ipc_consoleMirrorStatusUpdatedEvent
Expand Down Expand Up @@ -226,10 +228,6 @@ export class MirrorManager {
}

private async _playFile(filePath: string, playbackId: string) {
if (!this.mirrors[playbackId].isMirroring) {
return;
}

const replayComm: ReplayCommunication = {
mode: "mirror",
isRealTimeMode: this.mirrors[playbackId].isRealTimeMode,
Expand Down

0 comments on commit 0a8f594

Please sign in to comment.