saq 0.24.12__py3-none-any.whl → 0.24.13__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
saq/__init__.py CHANGED
@@ -14,4 +14,4 @@ __all__ = [
14
14
  "Worker",
15
15
  ]
16
16
 
17
- __version__ = "0.24.12"
17
+ __version__ = "0.24.13"
saq/queue/postgres.py CHANGED
@@ -888,7 +888,21 @@ class PostgresQueue(Queue):
888
888
 
889
889
  @asynccontextmanager
890
890
  async def _get_dequeue_conn(self) -> t.AsyncGenerator:
891
+ """
892
+ This context manager is used instead of the pool.connection() context manager because we need
893
+ to reuse specific connections outside of a context to properly manager advisory locks.
894
+ If advisory locks are not used, this context manager can be replaced with pool.connection().
895
+ """
891
896
  async with self._connection_lock:
897
+ # Check if the connection is still associated with a connection pool.
898
+ if not getattr(self._dequeue_conn, "_pool", None):
899
+ # The only known case of having a connection without a pool is when the connection was closed
900
+ # Therefore this close check shouldn't be needed but it doesn't hurt to close anyways
901
+ # to cover potential case where the connection is not closed and we would leave an open connection.
902
+ if self._dequeue_conn:
903
+ await self._dequeue_conn.close()
904
+ self._dequeue_conn = None
905
+
892
906
  if self._dequeue_conn:
893
907
  try:
894
908
  # Pool normally performs this check when getting a connection.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: saq
3
- Version: 0.24.12
3
+ Version: 0.24.13
4
4
  Summary: Distributed Python job queue with asyncio and redis
5
5
  Home-page: https://github.com/tobymao/saq
6
6
  Author: Toby Mao
@@ -1,4 +1,4 @@
1
- saq/__init__.py,sha256=-6W6CleVyyCSWJOyF4tfXRJ9nI6u-Y4KPRgZYraOhTg,219
1
+ saq/__init__.py,sha256=n2njj1ekrqBoS5BBfDJRAxeqL4HwEQixcjMOf12TGBc,219
2
2
  saq/__main__.py,sha256=N4RNqnCcj7eZbM3OyYaC03_6Cot-y-SxW5Hwx6fuzKU,2440
3
3
  saq/errors.py,sha256=XPJw6J3caSAho4ZybuodIbeuGjboVabLuf3NFOEE-4Q,112
4
4
  saq/job.py,sha256=X49OuSqZeN-RVmh4AonZRrwk2wU8MeukLSxrvjGLm7E,11552
@@ -10,7 +10,7 @@ saq/worker.py,sha256=W9rqK_u0bbvUbdb879pvf1f-suNnesKk1TjYqHQREc8,16817
10
10
  saq/queue/__init__.py,sha256=5LgBHGylCVvrLDcjMCcI2dRRgh0BPdz2TKOdc8NMs2E,87
11
11
  saq/queue/base.py,sha256=3Fc91Cgrpp1KUTRT0nPL9lroRmPCz7WGFpZkxDyMQh4,15919
12
12
  saq/queue/http.py,sha256=V9S26gJbUt5AUIR2ETasSQy4Q_K30eGtguBYHpfcLGU,7739
13
- saq/queue/postgres.py,sha256=Yqv73KKbAO7aC7URkjLGk_XR1JWQ2AQtqoGepLNPSzw,36130
13
+ saq/queue/postgres.py,sha256=HP-RKIb6OPa7I4QTrS1omWlDUPvzQRcjaB0ZrxnpYvE,37060
14
14
  saq/queue/postgres_migrations.py,sha256=gI6j-0TzlFFSWxji3Dy9aJ-llboJBm92J4tB_YZ7qI8,2080
15
15
  saq/queue/redis.py,sha256=sa_wzUUlfPw-RZ-v_cnDEJWEFyUi3sy_3YTqG4UklOA,17754
16
16
  saq/web/__init__.py,sha256=NG9LfjgJQxNft0_iZuZ3LnX1I58SfxRwKpycjazBoGE,23
@@ -20,9 +20,9 @@ saq/web/starlette.py,sha256=i38xuNcnQvWBY3jyHHu9Uo9ILSBzOwmk5Bq06c3CQzM,4432
20
20
  saq/web/static/app.js,sha256=i6PaRvBvt96LOINBdEuKkDvVeM-GA8lJiFg4jtQ3viY,7094
21
21
  saq/web/static/pico.min.css.gz,sha256=qCxIv3wWFMQ7MkvGSHQLwxio3121VvvieOkSjw6fv6o,9263
22
22
  saq/web/static/snabbdom.js.gz,sha256=zSO3Z761TB7bYNQFFEtypD0vCuqWesqPJeE5CuV4xRg,7603
23
- saq-0.24.12.dist-info/LICENSE,sha256=p208OXrLf_dMcvuRHpcinfsJdihCqKWbqtFXpw4kyW0,1065
24
- saq-0.24.12.dist-info/METADATA,sha256=g_SywCzbz3nXYipojXUVz7NQRIFK55UPXVpcPrHEuvU,7913
25
- saq-0.24.12.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
26
- saq-0.24.12.dist-info/entry_points.txt,sha256=HkKOud1K15_DV7AEltn8G5Ua10VqIgHaZ4BQit4fdOk,42
27
- saq-0.24.12.dist-info/top_level.txt,sha256=FMrrc5EiGr4sQkEDtUMHIpomnWHL9i6xT7B6lvEh8xM,4
28
- saq-0.24.12.dist-info/RECORD,,
23
+ saq-0.24.13.dist-info/LICENSE,sha256=p208OXrLf_dMcvuRHpcinfsJdihCqKWbqtFXpw4kyW0,1065
24
+ saq-0.24.13.dist-info/METADATA,sha256=-tfHuQvVYkcGER_GLb7mCNLAWbRkMM6wdtEa0EIMej0,7913
25
+ saq-0.24.13.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
26
+ saq-0.24.13.dist-info/entry_points.txt,sha256=HkKOud1K15_DV7AEltn8G5Ua10VqIgHaZ4BQit4fdOk,42
27
+ saq-0.24.13.dist-info/top_level.txt,sha256=FMrrc5EiGr4sQkEDtUMHIpomnWHL9i6xT7B6lvEh8xM,4
28
+ saq-0.24.13.dist-info/RECORD,,
File without changes
File without changes