Skip to content

Commit 4e471cf

Browse files
committed
Fix queue await error
1 parent 9697d5e commit 4e471cf

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
@@ -127,12 +127,24 @@ def _check_pgmq_ext(self) -> None:
127127
"""Check if the pgmq extension exists."""
128128
self._execute_operation(PGMQOperation.check_pgmq_ext, session=None, commit=True)
129129

130+
async def _check_pgmq_ext_async(self) -> None:
131+
"""Check if the pgmq extension exists (async version)."""
132+
await self._execute_async_operation(
133+
PGMQOperation.check_pgmq_ext_async, session=None, commit=True
134+
)
135+
130136
def _check_pg_partman_ext(self) -> None:
131137
"""Check if the pg_partman extension exists."""
132138
self._execute_operation(
133139
PGMQOperation.check_pg_partman_ext, session=None, commit=True
134140
)
135141

142+
async def _check_pg_partman_ext_async(self) -> None:
143+
"""Check if the pg_partman extension exists (async version)."""
144+
await self._execute_async_operation(
145+
PGMQOperation.check_pg_partman_ext_async, session=None, commit=True
146+
)
147+
136148
def _execute_operation(
137149
self,
138150
op_sync,
@@ -342,7 +354,7 @@ async def create_partitioned_queue_async(
342354
343355
"""
344356
# check if the pg_partman extension exists before creating a partitioned queue at runtime
345-
self._check_pg_partman_ext()
357+
await self._check_pg_partman_ext_async()
346358

347359
return await self._execute_async_operation(
348360
PGMQOperation.create_partitioned_queue_async,
@@ -451,7 +463,7 @@ async def drop_queue_async(
451463
"""
452464
# check if the pg_partman extension exists before dropping a partitioned queue at runtime
453465
if partitioned:
454-
self._check_pg_partman_ext()
466+
await self._check_pg_partman_ext_async()
455467

456468
return await self._execute_async_operation(
457469
PGMQOperation.drop_queue_async,

0 commit comments

Comments
 (0)