Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature(discover): trigger debounced discovery on consul config change #35

Merged
merged 2 commits into from
Jun 16, 2021

Conversation

ajcasagrande
Copy link
Contributor

Signed-off-by: Anthony Casagrande anthony.j.casagrande@intel.com

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

Issue Number:

#31

What is the new behavior?

Whenever a change to DiscoverySubnets or ScanPort is detected via a Consul watcher,
a discovery is automatically triggered after a 10-second de-bounced delay.

Does this PR introduce a breaking change?

  • No

New Imports

  • No

Other information

Right now this makes a call directly to the ProtocolDiscovery interface's Discover() function. One potential issue is that this bypasses the internal EdgeX mutex locking around being called multiple times. Because that code is internal to the SDK, there is no way to call it directly.

The alternative is to make a REST call to the /discovery endpoint, but I felt that was not a great solution especially considering the url and port to make the call against are not readily available information. Best case would probably be having the SDK add a public wrapper around triggering a discovery.

Copy link
Member

@tonyespy tonyespy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, and works as expected.

Note, I did run into an issue with the service and the registry while testing:

#36

@lenny-goodell lenny-goodell merged commit 8772bf5 into edgexfoundry:master Jun 16, 2021
@ajcasagrande ajcasagrande deleted the debounce-discover branch June 16, 2021 18:49
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.

3 participants