From 8326efb1237bf7388665f01852663c2761041747 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Renaudeau?= Date: Fri, 8 Jun 2018 12:24:24 +0200 Subject: [PATCH] Tweak the debounce time to fix (rare) false positive --- src/commands/listenDevices.js | 5 ++--- src/config/constants.js | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/commands/listenDevices.js b/src/commands/listenDevices.js index afef5057..2c4a17bd 100644 --- a/src/commands/listenDevices.js +++ b/src/commands/listenDevices.js @@ -4,8 +4,7 @@ import logger from 'logger' import { createCommand } from 'helpers/ipc' import { Observable } from 'rxjs' import CommNodeHid from '@ledgerhq/hw-transport-node-hid' - -const DEBOUNCE_REMOVE_DEVICE_EVENT = 500 +import { DEVICE_DISCONNECT_DEBOUNCE } from 'config/constants' const cmd = createCommand('listenDevices', () => Observable.create(o => { @@ -35,7 +34,7 @@ const cmd = createCommand('listenDevices', () => pendingRemovePerPath[e.descriptor] = setTimeout(() => { delete pendingRemovePerPath[e.descriptor] o.next(e) - }, DEBOUNCE_REMOVE_DEVICE_EVENT) + }, DEVICE_DISCONNECT_DEBOUNCE) break } default: diff --git a/src/config/constants.js b/src/config/constants.js index 6fc7c4b6..54beedfe 100644 --- a/src/config/constants.js +++ b/src/config/constants.js @@ -6,6 +6,8 @@ export const CHECK_APP_INTERVAL_WHEN_INVALID = 600 export const CHECK_APP_INTERVAL_WHEN_VALID = 1200 export const CHECK_UPDATE_DELAY = 5e3 +export const DEVICE_DISCONNECT_DEBOUNCE = 1000 + export const MODAL_ADD_ACCOUNT = 'MODAL_ADD_ACCOUNT' export const MODAL_OPERATION_DETAILS = 'MODAL_OPERATION_DETAILS' export const MODAL_RECEIVE = 'MODAL_RECEIVE'