redis-allocator 0.3.2__py3-none-any.whl → 0.3.3__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.
- redis_allocator/_version.py +1 -1
- redis_allocator/allocator.py +5 -2
- {redis_allocator-0.3.2.dist-info → redis_allocator-0.3.3.dist-info}/METADATA +1 -1
- {redis_allocator-0.3.2.dist-info → redis_allocator-0.3.3.dist-info}/RECORD +8 -8
- tests/conftest.py +1 -0
- {redis_allocator-0.3.2.dist-info → redis_allocator-0.3.3.dist-info}/WHEEL +0 -0
- {redis_allocator-0.3.2.dist-info → redis_allocator-0.3.3.dist-info}/licenses/LICENSE +0 -0
- {redis_allocator-0.3.2.dist-info → redis_allocator-0.3.3.dist-info}/top_level.txt +0 -0
redis_allocator/_version.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = '0.3.
|
1
|
+
__version__ = '0.3.3'
|
redis_allocator/allocator.py
CHANGED
@@ -97,7 +97,7 @@ class RedisAllocatableClass(ABC):
|
|
97
97
|
|
98
98
|
def open(self):
|
99
99
|
"""Open the object."""
|
100
|
-
|
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,15 +1,15 @@
|
|
1
1
|
redis_allocator/__init__.py,sha256=TVjUm-8YEu_MQD_PkfeIKiVknpCJBrUY9cWN1LlaZcU,1016
|
2
|
-
redis_allocator/_version.py,sha256=
|
3
|
-
redis_allocator/allocator.py,sha256=
|
2
|
+
redis_allocator/_version.py,sha256=on4Bj4mGEjEjyUkQExxprhOoEopcv_sPapsEnNxyelE,22
|
3
|
+
redis_allocator/allocator.py,sha256=oFJSRAhFJsBbeho5TibY81_3Vy07glrAuEhpIOYfeJI,47282
|
4
4
|
redis_allocator/lock.py,sha256=fqf6WUWHKYenEArWopMIF6kWEnDfADC-bZvnQImsQVo,27400
|
5
5
|
redis_allocator/task_queue.py,sha256=8DjNr2uxhzCsHatV_CHOeGh7_K9pqQZFApSbe2blRO0,14989
|
6
|
-
redis_allocator-0.3.
|
6
|
+
redis_allocator-0.3.3.dist-info/licenses/LICENSE,sha256=Wt4X1rHpffQfEiyWcDUx8BMLjXxfPqaiYZ7Lgsj7L4c,1068
|
7
7
|
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
|
-
tests/conftest.py,sha256=
|
8
|
+
tests/conftest.py,sha256=Ts82uylQSzP_GcaN0E02o3xcFdjw20cXNzh3RAdYKW4,3967
|
9
9
|
tests/test_allocator.py,sha256=hFKgLe_yONtEjjm6zssUnhK0tzihG_1xZMziztHmqqA,22404
|
10
10
|
tests/test_lock.py,sha256=MDMRNN46VhWqkHUIhYOMEDgZkFFCW_WjwRLTOjkFF-Q,46952
|
11
11
|
tests/test_task_queue.py,sha256=Fh5naikFajfOvL6GngEy_TPfOYCYZolZfVwtR6T4dTY,31710
|
12
|
-
redis_allocator-0.3.
|
13
|
-
redis_allocator-0.3.
|
14
|
-
redis_allocator-0.3.
|
15
|
-
redis_allocator-0.3.
|
12
|
+
redis_allocator-0.3.3.dist-info/METADATA,sha256=oEPcsqP1oiKP_HaZgIgfEEqIxuY6c9aoapC5ecLrP8w,21653
|
13
|
+
redis_allocator-0.3.3.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
14
|
+
redis_allocator-0.3.3.dist-info/top_level.txt,sha256=0hXzU7sK5FCeSolTEYxThOt3HOybnwaXv1FLRJvHVgI,22
|
15
|
+
redis_allocator-0.3.3.dist-info/RECORD,,
|
tests/conftest.py
CHANGED
File without changes
|
File without changes
|
File without changes
|