-
Notifications
You must be signed in to change notification settings - Fork 513
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
Register call_service
operation to run in its own thread
#847
Conversation
@achim-k what do you think of this change? I'm particularly interested in: Should it go in as-is, or should we have some configurability on whether to have service calls block vs. run in their own threads? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@achim-k what do you think of this change?
I'm particularly interested in: Should it go in as-is, or should we have some configurability on whether to have service calls block vs. run in their own threads?
Looks like a good improvement and changes are minimal 👍
Do you expect that change to break any existing use case?
I think it would make sense to have some sort of configurability (maybe a parameter) so users can disable the new behavior if, for whatever reason, this causes problems.
rosbridge_library/src/rosbridge_library/capabilities/call_service.py
Outdated
Show resolved
Hide resolved
I thought about this and there are two things that come to mind.
Anyways, I will work on making this configurable. Should this be an extra arg in the |
Both options would require making changes to the protocol specification and then adding support for this to the various client libraries (roslibjs, ...). How about just making this a server configuration for now? E.g. if call_services_in_thread:
protocol.register_operation("call_service", lambda msg: Thread(target=self.call_service, ...
else:
protocol.register_operation("call_service", self.call_service) |
@achim-k What do you think of this update? Added a |
Looks good, nice improvement |
Public API Changes
None
Description
I have changed the operation registered for
call_service
so that it's not blocking -- that is, theCallService.call_service()
implementation now runs in its own separate thread.This enables us to process multiple service calls in parallel, whereas right now the tools do them sequentially.
If folks are apprehensive about this blanket change, I could also envision allowing both options, so we could have a
call_service_blocking
operation that works as before, and acall_service
that uses the changes from this PR... or some other way to configure things. Open to feedback!Fixes #825