Skip to content

Commit

Permalink
mqtt-rpc-client: fix timeout handling (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
sikmir authored Feb 20, 2023
1 parent f30c01f commit e4d2198
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 4 additions & 2 deletions bin/mqtt-rpc-client
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import paho_socket
from jsonrpc.exceptions import JSONRPCError
from paho.mqtt import client as mqttclient

from mqttrpc.client import MQTTRPCError, TMQTTRPCClient
from mqttrpc.client import MQTTRPCError, TimeoutError, TMQTTRPCClient


def main():
Expand All @@ -28,7 +28,7 @@ def main():
parser.add_argument("-s", "--service", dest="service", type=str, help="Service name")
parser.add_argument("-m", "--method", dest="method", type=str, help="Method name")
parser.add_argument("-a", "--args", dest="args", type=json.loads, help="Method arguments")
parser.add_argument("-t", "--timeout", dest="timeout", type=int, help="Timeout", default=10)
parser.add_argument("-t", "--timeout", dest="timeout", type=int, help="Timeout in seconds", default=10)
args = parser.parse_args()

url = urlparse(args.broker_url)
Expand All @@ -54,6 +54,8 @@ def main():
pprint.pprint(resp)
except MQTTRPCError as e:
print("Error: %s" % e)
except TimeoutError:
print("Request timed out")


if __name__ == "__main__":
Expand Down
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
python-mqttrpc (1.1.8) stable; urgency=medium

* mqtt-rpc-client: fix timeout handling

-- Nikolay Korotkiy <nikolay.korotkiy@wirenboard.com> Wed, 15 Feb 2023 13:15:00 +0400

python-mqttrpc (1.1.7) stable; urgency=medium

* mqtt-rpc-client: fix error response handling
Expand Down

0 comments on commit e4d2198

Please sign in to comment.