Skip to content

Commit

Permalink
remove mulit
Browse files Browse the repository at this point in the history
  • Loading branch information
Ed-XCF committed Feb 3, 2023
1 parent 510425d commit 574ce77
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions redis_property.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,19 +109,16 @@ def __get__(self, instance, _):
key = self._make_key(instance)
value = safe_read(key)
if value is None:
with _redis_cli.pipeline() as pipeline:
while True:
try:
pipeline.watch(key)
value = safe_read(key, pipeline)
if value is None:
value = self.func(instance)
pipeline.multi()
safe_write(key, self._dumps(value), self.ttl, pipeline)
pipeline.execute()
return value
except WatchError:
continue
while True:
try:
_redis_cli.watch(key)
value = safe_read(key)
if value is None:
value = self.func(instance)
safe_write(key, self._dumps(value), self.ttl)
return value
except WatchError:
continue

if cache_disable.get():
value = self.func(instance)
Expand Down

0 comments on commit 574ce77

Please sign in to comment.