Browse Source

Tweak the debounce time to fix (rare) false positive

master
Gaëtan Renaudeau 7 years ago
parent
commit
8326efb123
  1. 5
      src/commands/listenDevices.js
  2. 2
      src/config/constants.js

5
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:

2
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'

Loading…
Cancel
Save