Commit 1f728a06 authored by Ignacio Corderi's avatar Ignacio Corderi
Browse files

AsyncClient now returns error when an operation is called when client is not conected

parent dc7ec1ff
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ This section will document changes to the library since the last release
- Added getVersion and getVersionAsync to the library.

## Bug Fixes
- AsyncClient returns NotConnected exception when an operation is attempted on a client before calling connect().
- Lowered default number of keys asked on ranges to 200 (ASKOVAD-287)
- Fixed typo on baset test case (Merge #2, contributed by @zaitcev)

+8 −0
Original line number Diff line number Diff line
@@ -141,7 +141,12 @@ class BaseAsync(Client):
        # transmit
        self.network_send(header, value)

    def _process(self, op, *args, **kwargs):
        if not self.isConnected: raise common.NotConnected("Must call connect() before sending operations.")
        super(BaseAsync, self)._process(op, *args, **kwargs)

    def _processAsync(self, op, onSuccess, onError, *args, **kwargs):
        if not self.isConnected: raise common.NotConnected("Must call connect() before sending operations.")

        def innerSuccess(header, value):
            onSuccess(op.parse(header, value))
@@ -183,6 +188,9 @@ class BaseAsync(Client):
    def flushAsync(self, onSuccess, onError, *args, **kwargs):
        self._processAsync(operations.Flush, onSuccess, onError, *args, **kwargs)

    def noopAsync(self, onSuccess, onError, *args, **kwargs):
        self._processAsync(operations.Noop, onSuccess, onError, *args, **kwargs)