Skip to content

Commit

Permalink
fix(bluetooth): improve adapter stability
Browse files Browse the repository at this point in the history
  • Loading branch information
mKeRix committed Jan 10, 2021
1 parent 112441b commit 27112a0
Show file tree
Hide file tree
Showing 6 changed files with 184 additions and 166 deletions.
209 changes: 80 additions & 129 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -111,7 +111,7 @@
"vuepress-plugin-sitemap": "^2.3.1"
},
"optionalDependencies": {
"@mkerix/noble": "1.9.2-10.1",
"@mkerix/noble": "1.9.2-10.2",
"i2c-bus": "^5.1.0",
"mdns": "^2.5.1",
"onoff": "^6.0.0"
Expand Down
Expand Up @@ -487,19 +487,19 @@ export class BluetoothLowEnergyService

this.handleAppDiscovery(tag.id, appId);
} catch (e) {
if (e.message === 'timed out') {
if (e.message?.includes('already locked')) {
this.logger.debug(
`Temporarily denylisting ${tag.id} from app discovery due to timeout`
`Unable to retrieve companion ID, retrying on next advertisement: ${e.message}`
);
} else {
this.logger.warn(
`Temporarily denylisting ${tag.id} from app discovery due to error: ${e.message}`
);
this.companionAppDenylist.add(tag.id);
setTimeout(
() => this.companionAppDenylist.delete(tag.id),
3 * 60 * 1000
);
} else {
this.logger.debug(
`Unable to retrieve companion ID, retrying on next advertisement: ${e.message}`
);
}

this.companionAppTags.delete(tag.id);
Expand Down

0 comments on commit 27112a0

Please sign in to comment.