question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Erratic times between scan discovery

See original GitHub issue

I’m currently using noble on a MacBook running Sierra and trying to discover a Puck.js that’s advertising a counter variable which indicates button presses. I never actually connect the Puck.js, I just read the values it’s advertising.

I’ve noticed that there can be quite a range in the amount of time between each on('discover') event being emitted. For example, the following (simplified) code.

const noble = require('noble');

noble.on('stateChange', (state) => {
  if (state === 'poweredOn') {
    noble.startScanning([], true);
  } else {
    noble.stopScanning();
  }
});

let lastDate = Date.now();
noble.on('discover', () => {
  const now = Date.now();
  const diff = (now - lastDate) / 1000;
  console.log(`Discovered! Time since last reading: ${diff}s.`);
  lastDate = now;
});

Produces the following output:

Noble seems to be able to discover at most once every 1.5 seconds, but sometimes it can be 20+ seconds between discoveries. Granted, I’m using Noble in quite a hacky way (checking an advertised counter variable to see if the button has been pressed) but I wanted to find out if there was anything I could be doing to make the time between these discoveries be more consistently around the 1.5 second mark.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
sandeepmistrycommented, Jun 18, 2017

@joshfarrant thanks for the update. It looks like something internal with CoreBluetooth/blued on macOS which is requires Apple’s help. I’ll close this for now since you have a workaround.

0reactions
fafa92commented, Jun 17, 2017

@joshfarrant thanks for your clarification, but I have this problem with my Raspberry Pi zero actually! after few seconds it cannot discover any BLE device.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Discovery scan times out... Nothing in sc-logs that's interesting
These messages begin being logged eight hours after the scan is initiated and the pattern of (timer countdown, timer reset) repeats. The scan ......
Read more >
BMC Discovery scan got stuck 99% - Discussion
Discovery : A scan (Discovery Run) never ends, it is stuck and does not complete ... The only difference between a schedule and...
Read more >
Configure scan settings in Assets Discovery - Atlassian Support
The Scan settings tab allows you to select an IP address or range of IP addresses to scan when Assets Discovery is executed....
Read more >
Discovery and Disclosure of Incidental Findings in ... - NCBI
2a). Lag time between data acquisition and reading generally occurs within one week in 74% (32/43), and within one month in 26% (11/43)...
Read more >
Scan problems - HCL Product Documentation
The most common problems with software scans are reported on the Scan Health ... its version from the computers to BigFix Inventory might...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found