Browse Source
Merge pull request #479 from gre/fix-disconnect-false-positive
Tweak the debounce time to fix (rare) false positive
master
Meriadec Pillet
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
4 additions and
3 deletions
-
src/commands/listenDevices.js
-
src/config/constants.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: |
|
|
|
|
|
@ -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' |
|
|
|