1
1
import pickle
2
2
from typing import Any , Final , Literal , Optional , TypeVar , cast
3
3
4
- from psqlpy import PSQLPool
4
+ from psqlpy import ConnectionPool
5
5
from psqlpy .exceptions import RustPSQLDriverPyBaseError
6
6
from taskiq import AsyncResultBackend , TaskiqResult
7
7
@@ -33,23 +33,23 @@ def __init__(
33
33
34
34
:param dsn: connection string to PostgreSQL.
35
35
:param keep_results: flag to not remove results from Redis after reading.
36
- :param connect_kwargs: additional arguments for nats `PSQLPool ` class.
36
+ :param connect_kwargs: additional arguments for nats `ConnectionPool ` class.
37
37
"""
38
38
self .dsn : Final = dsn
39
39
self .keep_results : Final = keep_results
40
40
self .table_name : Final = table_name
41
41
self .field_for_task_id : Final = field_for_task_id
42
42
self .connect_kwargs : Final = connect_kwargs
43
43
44
- self ._database_pool : PSQLPool
44
+ self ._database_pool : ConnectionPool
45
45
46
46
async def startup (self ) -> None :
47
47
"""Initialize the result backend.
48
48
49
49
Construct new connection pool
50
50
and create new table for results if not exists.
51
51
"""
52
- self ._database_pool = PSQLPool (
52
+ self ._database_pool = ConnectionPool (
53
53
dsn = self .dsn ,
54
54
** self .connect_kwargs ,
55
55
)
@@ -68,7 +68,7 @@ async def startup(self) -> None:
68
68
69
69
async def shutdown (self ) -> None :
70
70
"""Close the connection pool."""
71
- await self ._database_pool .close ()
71
+ self ._database_pool .close ()
72
72
73
73
async def set_result (
74
74
self ,
0 commit comments