-
Notifications
You must be signed in to change notification settings - Fork 126
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
Discover function lock release issue #609
Comments
202 indicates
This do limit the implementation of ProtocolDiscovery to send devices as a batch in one protocol-specific discovery process though. @lenny-intel @iain-anderson @cloudxxx8 may you share you thought on above topics ? |
I'd be tempted to write a wrapper function that called discovery.Discover() and released the lock when that call had completed. |
Add a wrapper function to call discovery.Discovery() and release the lock when call completed so that developer will not be forced to push something to deviceCh to release the lock fix edgexfoundry#609 Signed-off-by: Chris Hung <chris@iotechsys.com>
Add a wrapper function to call discovery.Discovery() and release the lock when call completed so that developer will not be forced to push something to deviceCh to release the lock fix edgexfoundry#609 Signed-off-by: Chris Hung <chris@iotechsys.com>
Add a wrapper function to call discovery.Discovery() and release the lock when call completed so that developer will not be forced to push something to deviceCh to release the lock fix edgexfoundry#609 Signed-off-by: Chris Hung <chris@iotechsys.com>
Currently the lock for a currently running discover process is only released when data is sent over the
deviceCh
.device-sdk-go/pkg/service/async.go
Lines 124 to 125 in fb7330f
In reality it should be tied to when the discover function completes.
device-sdk-go/internal/handler/control.go
Line 57 in 5d94347
The reason for this is because the way it is now, the only way to "tell" the SDK that you are done is to send data over that channel, even if it is just
nil
. If you do not send data on that channel the SDK will assume you are still discovering forever.On top of that it does not allow the discover process to add devices on-the-fly as they are discovered, otherwise the SDK will incorrectly assume discovery is complete and release the lock. This forces the developer to buffer up the discovered devices and release them as a batch at the end.
The text was updated successfully, but these errors were encountered: