Commit e7a5d6b0 authored by Paul Dardeau's avatar Paul Dardeau
Browse files

Added support for no_async sends

parent 1ac29430
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -132,7 +132,7 @@ class BaseAsync(deprecated.BlockingClient):
    ###


    def sendAsync(self, command, value, onSuccess, onError):
    def sendAsync(self, command, value, onSuccess, onError, no_ack=False):
        if self.faulted: # TODO(Nacho): should we fault through onError on fault or bow up on the callers face?
            self._raise(common.ConnectionFaulted("Can't send message when connection is on a faulted state."), onError)
            return #skip the rest
@@ -152,6 +152,7 @@ class BaseAsync(deprecated.BlockingClient):
        # get sequence
        self.update_header(command)

        if not no_ack:
            # add callback to pending dictionary
            self._pending[command.header.sequence] = (innerSuccess, onError)

@@ -177,8 +178,14 @@ class BaseAsync(deprecated.BlockingClient):
            except Exception as e2:
                onError(e2)

        if 'no_ack' in kwargs:
            send_no_ack = True
            del kwargs['no_ack']
        else:
            send_no_ack = False

        header, value = op.build(*args, **kwargs)
        self.sendAsync(header, value, innerSuccess, innerError)
        self.sendAsync(header, value, innerSuccess, innerError, send_no_ack)


    def putAsync(self, onSuccess, onError, *args, **kwargs):