redis-allocator 0.4.6__py3-none-any.whl → 0.5.0__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.
@@ -1 +1 @@
1
- __version__ = '0.4.6'
1
+ __version__ = '0.5.0'
@@ -304,6 +304,11 @@ class RedisAllocatorPolicy(ABC, Generic[U]):
304
304
  """
305
305
  pass
306
306
 
307
+ @abstractmethod
308
+ def refresh_pool_all(self, allocator: 'RedisAllocator[U]'):
309
+ """Refresh the allocation pool."""
310
+ pass
311
+
307
312
  def check_health_once(self, r_obj: RedisAllocatorObject[U], duration: int = 3600) -> bool:
308
313
  """Check the health of the object."""
309
314
  with contextlib.closing(r_obj.open()):
@@ -405,6 +410,10 @@ class DefaultRedisAllocatorPolicy(RedisAllocatorPolicy[U]):
405
410
  self._update_lock_key = f"{allocator._pool_str()}|policy_update_lock"
406
411
  atexit.register(lambda: self.finalize(self._allocator()))
407
412
 
413
+ def refresh_pool_all(self, allocator: 'RedisAllocator[U]'):
414
+ for _ in range(self.updater.params):
415
+ self.refresh_pool(allocator)
416
+
408
417
  def malloc(self, allocator: 'RedisAllocator[U]', timeout: Timeout = 120,
409
418
  obj: Optional[U] = None, params: Optional[dict] = None,
410
419
  cache_timeout: Timeout = 3600) -> Optional[RedisAllocatorObject[U]]:
@@ -786,9 +795,9 @@ class RedisAllocator(RedisLockPool, Generic[U]):
786
795
  push_to_tail(itemName, expiry)
787
796
  end
788
797
  else
789
- if locked then
790
- set_item_allocated(itemName, value)
791
- end
798
+ -- if locked then
799
+ -- set_item_allocated(itemName, value)
800
+ -- end
792
801
  end
793
802
  end
794
803
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: redis-allocator
3
- Version: 0.4.6
3
+ Version: 0.5.0
4
4
  Summary: Redis-based resource allocation system.
5
5
  Home-page: https://github.com/invoker-bot/RedisAllocator-python
6
6
  Author: Invoker Bot
@@ -1,15 +1,15 @@
1
1
  redis_allocator/__init__.py,sha256=TVjUm-8YEu_MQD_PkfeIKiVknpCJBrUY9cWN1LlaZcU,1016
2
- redis_allocator/_version.py,sha256=Kz7woA4tU2VuvwrlsLhgdzMyOrCqVahApsovYLgj_0M,22
3
- redis_allocator/allocator.py,sha256=8ReS-cWbAjuhMhlCbfr-FI6Q-pQO__VQWEk5I8O_MPM,52930
2
+ redis_allocator/_version.py,sha256=0PaI2eSOCp5kkNcpKpUSbLHf66rL9xQzFpYyLGpEtyM,22
3
+ redis_allocator/allocator.py,sha256=lfrMKzrIs8f8QJymPA-hghu0CYMZ842EckbM6Pf91GM,53231
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.4.6.dist-info/licenses/LICENSE,sha256=Wt4X1rHpffQfEiyWcDUx8BMLjXxfPqaiYZ7Lgsj7L4c,1068
6
+ redis_allocator-0.5.0.dist-info/licenses/LICENSE,sha256=Wt4X1rHpffQfEiyWcDUx8BMLjXxfPqaiYZ7Lgsj7L4c,1068
7
7
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
8
  tests/conftest.py,sha256=Ts82uylQSzP_GcaN0E02o3xcFdjw20cXNzh3RAdYKW4,3967
9
9
  tests/test_allocator.py,sha256=zOBdaOhlpLsv63J4QZ9vOhL1k1gu_vO68x4CpPDa9_4,23350
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.4.6.dist-info/METADATA,sha256=HvlGuWcNB30DLHHzgIRBgw6T3cUiycNHNCMefk4mWq0,21727
13
- redis_allocator-0.4.6.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
14
- redis_allocator-0.4.6.dist-info/top_level.txt,sha256=0hXzU7sK5FCeSolTEYxThOt3HOybnwaXv1FLRJvHVgI,22
15
- redis_allocator-0.4.6.dist-info/RECORD,,
12
+ redis_allocator-0.5.0.dist-info/METADATA,sha256=P4KcojPDhtyoaAIuqiFOkQOnkXJQFgmLeOL_GGNr1SQ,21727
13
+ redis_allocator-0.5.0.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
14
+ redis_allocator-0.5.0.dist-info/top_level.txt,sha256=0hXzU7sK5FCeSolTEYxThOt3HOybnwaXv1FLRJvHVgI,22
15
+ redis_allocator-0.5.0.dist-info/RECORD,,