Skip to content

Commit

Permalink
Should fix #25
Browse files Browse the repository at this point in the history
  • Loading branch information
rudyryk committed May 2, 2016
1 parent 6a11dd4 commit 0c47ebe
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions peewee_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -840,11 +840,16 @@ def connect_async(self, loop=None, timeout=None):
timeout=timeout,
**self.connect_kwargs_async)

yield from conn.connect()

self._task_data = TaskLocals(loop=self.loop)
self._async_conn = conn
self._async_wait.set_result(True)
try:
yield from conn.connect()
except:
self._async_wait.cancel()
self._async_wait = None
raise
else:
self._task_data = TaskLocals(loop=self.loop)
self._async_conn = conn
self._async_wait.set_result(True)

@asyncio.coroutine
def cursor_async(self):
Expand Down

1 comment on commit 0c47ebe

@rudyryk
Copy link
Member Author

@rudyryk rudyryk commented on 0c47ebe May 2, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, this should fix #24, commit message points to another issue

Please sign in to comment.