redis-allocator 0.3.2__tar.gz → 0.3.3__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 (22) hide show
  1. {redis_allocator-0.3.2/redis_allocator.egg-info → redis_allocator-0.3.3}/PKG-INFO +1 -1
  2. {redis_allocator-0.3.2 → redis_allocator-0.3.3}/pyproject.toml +1 -1
  3. redis_allocator-0.3.3/redis_allocator/_version.py +1 -0
  4. {redis_allocator-0.3.2 → redis_allocator-0.3.3}/redis_allocator/allocator.py +5 -2
  5. {redis_allocator-0.3.2 → redis_allocator-0.3.3/redis_allocator.egg-info}/PKG-INFO +1 -1
  6. {redis_allocator-0.3.2 → redis_allocator-0.3.3}/tests/conftest.py +1 -0
  7. redis_allocator-0.3.2/redis_allocator/_version.py +0 -1
  8. {redis_allocator-0.3.2 → redis_allocator-0.3.3}/LICENSE +0 -0
  9. {redis_allocator-0.3.2 → redis_allocator-0.3.3}/README.md +0 -0
  10. {redis_allocator-0.3.2 → redis_allocator-0.3.3}/redis_allocator/__init__.py +0 -0
  11. {redis_allocator-0.3.2 → redis_allocator-0.3.3}/redis_allocator/lock.py +0 -0
  12. {redis_allocator-0.3.2 → redis_allocator-0.3.3}/redis_allocator/task_queue.py +0 -0
  13. {redis_allocator-0.3.2 → redis_allocator-0.3.3}/redis_allocator.egg-info/SOURCES.txt +0 -0
  14. {redis_allocator-0.3.2 → redis_allocator-0.3.3}/redis_allocator.egg-info/dependency_links.txt +0 -0
  15. {redis_allocator-0.3.2 → redis_allocator-0.3.3}/redis_allocator.egg-info/requires.txt +0 -0
  16. {redis_allocator-0.3.2 → redis_allocator-0.3.3}/redis_allocator.egg-info/top_level.txt +0 -0
  17. {redis_allocator-0.3.2 → redis_allocator-0.3.3}/setup.cfg +0 -0
  18. {redis_allocator-0.3.2 → redis_allocator-0.3.3}/setup.py +0 -0
  19. {redis_allocator-0.3.2 → redis_allocator-0.3.3}/tests/__init__.py +0 -0
  20. {redis_allocator-0.3.2 → redis_allocator-0.3.3}/tests/test_allocator.py +0 -0
  21. {redis_allocator-0.3.2 → redis_allocator-0.3.3}/tests/test_lock.py +0 -0
  22. {redis_allocator-0.3.2 → redis_allocator-0.3.3}/tests/test_task_queue.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: redis-allocator
3
- Version: 0.3.2
3
+ Version: 0.3.3
4
4
  Summary: Redis-based resource allocation system.
5
5
  Home-page: https://github.com/invoker-bot/RedisAllocator-python
6
6
  Author: Invoker Bot
@@ -4,7 +4,7 @@ build-backend = 'setuptools.build_meta'
4
4
 
5
5
  [tool.commitizen]
6
6
  name = "cz_conventional_commits"
7
- version = "0.3.2"
7
+ version = "0.3.3"
8
8
  tag_format = "v$version"
9
9
 
10
10
  [tool.commitizen.version_files]
@@ -0,0 +1 @@
1
+ __version__ = '0.3.3'
@@ -97,7 +97,7 @@ class RedisAllocatableClass(ABC):
97
97
 
98
98
  def open(self):
99
99
  """Open the object."""
100
- pass
100
+ return self
101
101
 
102
102
  def close(self):
103
103
  """close the object."""
@@ -162,6 +162,7 @@ class RedisAllocatorObject(Generic[U]):
162
162
  """Open the object."""
163
163
  if self.obj is not None:
164
164
  self.obj.open()
165
+ return self
165
166
 
166
167
  def close(self):
167
168
  """Kill the object."""
@@ -282,9 +283,11 @@ class RedisAllocatorPolicy(ABC):
282
283
 
283
284
  def check_health_once(self, r_obj: RedisAllocatorObject, duration: int = 3600) -> bool:
284
285
  """Check the health of the object."""
285
- with contextlib.closing(r_obj):
286
+ with contextlib.closing(r_obj.open()):
286
287
  try:
287
288
  if r_obj.is_healthy():
289
+ if r_obj.allocator.shared:
290
+ r_obj.allocator.unlock(r_obj.key) # set the key as free
288
291
  return True
289
292
  else:
290
293
  r_obj.set_unhealthy(duration)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: redis-allocator
3
- Version: 0.3.2
3
+ Version: 0.3.3
4
4
  Summary: Redis-based resource allocation system.
5
5
  Home-page: https://github.com/invoker-bot/RedisAllocator-python
6
6
  Author: Invoker Bot
@@ -66,6 +66,7 @@ class _TestObject(RedisAllocatableClass):
66
66
  def open(self):
67
67
  """Open the object."""
68
68
  self.closed = False
69
+ return self
69
70
 
70
71
  def close(self):
71
72
  """Mark the object as closed."""
@@ -1 +0,0 @@
1
- __version__ = '0.3.2'
File without changes