Skip to content

Honor scan_duration_sec when scheduling the discovery scan stop - #1468

Open
brittonbeckham wants to merge 1 commit into
faucetsdn:masterfrom
RadixIoT:fix/discovery-scan-duration
Open

brittonbeckham wants to merge 1 commit into
faucetsdn:masterfrom
RadixIoT:fix/discovery-scan-duration

Conversation

@brittonbeckham

Copy link
Copy Markdown

Summary

DiscoveryManager.startDiscoveryScan scheduled the scan stop with the SCAN_DURATION_SEC constant (10 s), so a family's configured scan_duration_sec was ignored. getScanDuration(family) already reads the config and falls back to the same default, but nothing called it.

A gateway proxying a large BACnet network needs more than 10 s to read point details; with the hard-coded stop, devices still being read when the window closes are cut off.

Changes

  • startDiscoveryScan computes the stop time from getScanDuration(family).
  • New DiscoveryManagerTest: configured duration (60 s) and unset duration (default 10 s). The 60 s case fails without the fix (expected:<60> but was:<10>).

startDiscoveryScan scheduled the stop with the SCAN_DURATION_SEC constant
(10 s), so a configured scan_duration_sec was ignored. Use getScanDuration,
which already reads the config and falls back to the same default.
@jamiebrind

Copy link
Copy Markdown
Collaborator

Core fix is valid (building on PR #1113): DiscoveryManager.startDiscoveryScan hardcoded SCAN_DURATION_SEC (10s) from the original 2022 Pubber stub; PR #1113
later added getScanDuration(family) without wiring it into startDiscoveryScan, and there are no comments suggesting the 10s cutoff was intentional, which was introduced in PR #235.

scan_duration_sec = 0 (schema-valid) needs handling: config_discovery_family.json allows 0, which now stops async providers immediately (0ms delay) and, during periodic scans, causes scheduleDiscoveryScan to either tight-loop hundreds of scans within the same second or permanently stall in STOPPED if finished within the same millisecond.

@khyatimahendru
khyatimahendru self-requested a review October 29, 2026 14:09

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants