diff --git a/nameko_grpc/client.py b/nameko_grpc/client.py index 224943d..3ffb88f 100644 --- a/nameko_grpc/client.py +++ b/nameko_grpc/client.py @@ -143,13 +143,14 @@ def default_compression(self): def start(self): if not self.lazy: - self._channel = self._get_channel() + self._start_channel() - def _get_channel(self): + def _start_channel(self): with self._channel_creation_lock: - channel = ClientChannel(self.target, self.ssl, self.spawn_thread) - channel.start() - return channel + if self._channel is None: + channel = ClientChannel(self.target, self.ssl, self.spawn_thread) + channel.start() + self._channel = channel def stop(self): if self._channel is not None: @@ -159,7 +160,7 @@ def stop(self): @property def channel(self): if self._channel is None: - self._channel = self._get_channel() + self._start_channel() return self._channel def timeout(self, send_stream, response_stream, deadline):