Skip to content

Commit

Permalink
Optional wait for timeout.
Browse files Browse the repository at this point in the history
  • Loading branch information
eerimoq committed Jun 26, 2020
1 parent 930b92b commit 799e0a1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions bunga/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@ async def on_get_file_rsp(self, message):
async def on_put_file_rsp(self, message):
await self._write_completed(message)

async def wait_for_connection(self):
async def wait_for_connection(self, timeout=None):
if not self._is_connected:
await self._connected_event.wait()
await asyncio.wait_for(self._connected_event.wait(), timeout)

if self._connect_exception:
raise self._connect_exception
Expand Down Expand Up @@ -325,8 +325,8 @@ def run(self):
def stop(self):
pass

def wait_for_connection(self):
asyncio.run_coroutine_threadsafe(self._client.wait_for_connection(),
def wait_for_connection(self, timeout=None):
asyncio.run_coroutine_threadsafe(self._client.wait_for_connection(timeout),
self._loop).result()

def execute_command(self, command):
Expand Down
2 changes: 1 addition & 1 deletion bunga/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.39.0'
__version__ = '0.40.0'

0 comments on commit 799e0a1

Please sign in to comment.