saq 0.24.12__tar.gz → 0.24.13__tar.gz

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.
Files changed (34) hide show
  1. {saq-0.24.12/saq.egg-info → saq-0.24.13}/PKG-INFO +1 -1
  2. {saq-0.24.12 → saq-0.24.13}/saq/__init__.py +1 -1
  3. {saq-0.24.12 → saq-0.24.13}/saq/queue/postgres.py +14 -0
  4. {saq-0.24.12 → saq-0.24.13/saq.egg-info}/PKG-INFO +1 -1
  5. {saq-0.24.12 → saq-0.24.13}/LICENSE +0 -0
  6. {saq-0.24.12 → saq-0.24.13}/MANIFEST.in +0 -0
  7. {saq-0.24.12 → saq-0.24.13}/README.md +0 -0
  8. {saq-0.24.12 → saq-0.24.13}/saq/__main__.py +0 -0
  9. {saq-0.24.12 → saq-0.24.13}/saq/errors.py +0 -0
  10. {saq-0.24.12 → saq-0.24.13}/saq/job.py +0 -0
  11. {saq-0.24.12 → saq-0.24.13}/saq/multiplexer.py +0 -0
  12. {saq-0.24.12 → saq-0.24.13}/saq/py.typed +0 -0
  13. {saq-0.24.12 → saq-0.24.13}/saq/queue/__init__.py +0 -0
  14. {saq-0.24.12 → saq-0.24.13}/saq/queue/base.py +0 -0
  15. {saq-0.24.12 → saq-0.24.13}/saq/queue/http.py +0 -0
  16. {saq-0.24.12 → saq-0.24.13}/saq/queue/postgres_migrations.py +0 -0
  17. {saq-0.24.12 → saq-0.24.13}/saq/queue/redis.py +0 -0
  18. {saq-0.24.12 → saq-0.24.13}/saq/types.py +0 -0
  19. {saq-0.24.12 → saq-0.24.13}/saq/utils.py +0 -0
  20. {saq-0.24.12 → saq-0.24.13}/saq/web/__init__.py +0 -0
  21. {saq-0.24.12 → saq-0.24.13}/saq/web/aiohttp.py +0 -0
  22. {saq-0.24.12 → saq-0.24.13}/saq/web/common.py +0 -0
  23. {saq-0.24.12 → saq-0.24.13}/saq/web/starlette.py +0 -0
  24. {saq-0.24.12 → saq-0.24.13}/saq/web/static/app.js +0 -0
  25. {saq-0.24.12 → saq-0.24.13}/saq/web/static/pico.min.css.gz +0 -0
  26. {saq-0.24.12 → saq-0.24.13}/saq/web/static/snabbdom.js.gz +0 -0
  27. {saq-0.24.12 → saq-0.24.13}/saq/worker.py +0 -0
  28. {saq-0.24.12 → saq-0.24.13}/saq.egg-info/SOURCES.txt +0 -0
  29. {saq-0.24.12 → saq-0.24.13}/saq.egg-info/dependency_links.txt +0 -0
  30. {saq-0.24.12 → saq-0.24.13}/saq.egg-info/entry_points.txt +0 -0
  31. {saq-0.24.12 → saq-0.24.13}/saq.egg-info/requires.txt +0 -0
  32. {saq-0.24.12 → saq-0.24.13}/saq.egg-info/top_level.txt +0 -0
  33. {saq-0.24.12 → saq-0.24.13}/setup.cfg +0 -0
  34. {saq-0.24.12 → saq-0.24.13}/setup.py +0 -0
@@ -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
@@ -14,4 +14,4 @@ __all__ = [
14
14
  "Worker",
15
15
  ]
16
16
 
17
- __version__ = "0.24.12"
17
+ __version__ = "0.24.13"
@@ -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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes