Skip to content

Conversation

@Fatme
Copy link
Contributor

@Fatme Fatme commented Nov 20, 2018

In case when some .js file is changed, preview app is restarted on device e.g preview app is stopped and started again. When the preview app is stopped, Pubnub reports the device as lost and when preview app is started, Pubnub reports the device as found. With this fix, we want to delay the emitting of deviceLost event. This way we'll give a chance to find the device before reporting it as lost.

PR Checklist

In case when some `.js` file is changed, preview app is restarted on device e.g preview app is stopped and started again. When the preview app is stopped, Pubnub reports the device as lost and when preview app is started, Pubnub reports the device as found. With this fix, we want to delay the emitting of deviceLost event. This way we'll give a chance to find the device before reporting it as lost.
@Fatme Fatme added this to the 5.0.2 milestone Nov 20, 2018
@Fatme Fatme self-assigned this Nov 20, 2018

export class PreviewDevicesService extends EventEmitter implements IPreviewDevicesService {
private connectedDevices: Device[] = [];
private deviceTimers: IDictionary<NodeJS.Timer> = {};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deviceTimers -> deviceLostTimers

clearTimeout(this.deviceTimers[device.id]);
}

this.emit(DeviceDiscoveryEventNames.DEVICE_FOUND, device);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be in else (we could also add a test for such case)?

@Fatme Fatme merged commit 8248829 into release Nov 21, 2018
@Fatme Fatme deleted the fatme/device-lost-after-timeout branch November 21, 2018 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants