Skip to content

Commit 69f82f6

Browse files
committed
no connection on empty pool
1 parent 1092b97 commit 69f82f6

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

test_thingsdb.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ async def async_test_playground(self):
1010

1111
client = Client(ssl=True)
1212

13-
await client.connect('playground.thingsdb.net', 9400)
13+
# await client.connect('playground.thingsdb.net', 9400)
1414
try:
15-
await client.authenticate('Fai6NmH7QYxA6WLYPdtgcy')
15+
# await client.authenticate('Fai6NmH7QYxA6WLYPdtgcy')
1616
data = await client.query(
1717
code='.greetings[index];',
1818
index=1,
@@ -26,3 +26,6 @@ async def async_test_playground(self):
2626
def test_playground(self):
2727
loop = asyncio.get_event_loop()
2828
loop.run_until_complete(self.async_test_playground())
29+
30+
31+
TestPlayground().test_playground()

thingsdb/client/client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,8 @@ async def _ensure_write(
339339
is_bin: bool = False,
340340
timeout: Optional[int] = None
341341
) -> asyncio.Future:
342+
if not self._pool:
343+
raise ConnectionError('no connection')
342344
while True:
343345
if not self.is_connected():
344346
logging.info('Wait for a connection')

0 commit comments

Comments
 (0)