Skip to content

Commit 9e76606

Browse files
committed
Fix queue await error
1 parent 23508b9 commit 9e76606

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

pgmq_sqlalchemy/queue.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,24 @@ def _check_pgmq_ext(self) -> None:
111111
"""Check if the pgmq extension exists."""
112112
self._execute_operation(PGMQOperation.check_pgmq_ext, session=None, commit=True)
113113

114+
async def _check_pgmq_ext_async(self) -> None:
115+
"""Check if the pgmq extension exists (async version)."""
116+
await self._execute_async_operation(
117+
PGMQOperation.check_pgmq_ext_async, session=None, commit=True
118+
)
119+
114120
def _check_pg_partman_ext(self) -> None:
115121
"""Check if the pg_partman extension exists."""
116122
self._execute_operation(
117123
PGMQOperation.check_pg_partman_ext, session=None, commit=True
118124
)
119125

126+
async def _check_pg_partman_ext_async(self) -> None:
127+
"""Check if the pg_partman extension exists (async version)."""
128+
await self._execute_async_operation(
129+
PGMQOperation.check_pg_partman_ext_async, session=None, commit=True
130+
)
131+
120132
def _execute_operation(
121133
self,
122134
op_sync,
@@ -326,7 +338,7 @@ async def create_partitioned_queue_async(
326338
327339
"""
328340
# check if the pg_partman extension exists before creating a partitioned queue at runtime
329-
self._check_pg_partman_ext()
341+
await self._check_pg_partman_ext_async()
330342

331343
return await self._execute_async_operation(
332344
PGMQOperation.create_partitioned_queue_async,
@@ -435,7 +447,7 @@ async def drop_queue_async(
435447
"""
436448
# check if the pg_partman extension exists before dropping a partitioned queue at runtime
437449
if partitioned:
438-
self._check_pg_partman_ext()
450+
await self._check_pg_partman_ext_async()
439451

440452
return await self._execute_async_operation(
441453
PGMQOperation.drop_queue_async,

0 commit comments

Comments
 (0)