Skip to content

Commit

Permalink
Use BailOutExecutor in more places (#482)
Browse files Browse the repository at this point in the history
This makes `Redlock.locked()` and the `NextId.__current_id` getter more
efficient for several masters.
  • Loading branch information
brainix authored Oct 17, 2021
1 parent 656dc8f commit 1d29eeb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pottery/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@


__title__ = 'pottery'
__version__ = '1.4.5'
__version__ = '1.4.6'
__description__ = __doc__.split(sep='\n\n', maxsplit=1)[0]
__url__ = 'https://github.com/brainix/pottery'
__author__ = 'Rajiv Bakulesh Shah'
Expand Down
2 changes: 1 addition & 1 deletion pottery/nextid.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def __next__(self) -> int:

@property
def __current_id(self) -> int:
with concurrent.futures.ThreadPoolExecutor() as executor:
with BailOutExecutor() as executor:
futures = set()
for master in self.masters:
future = executor.submit(master.get, self.key)
Expand Down
3 changes: 1 addition & 2 deletions pottery/redlock.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,7 @@ def locked(self, *, raise_on_redis_errors: Optional[bool] = None) -> int:
>>> printer_lock_1.release()
'''
with ContextTimer() as timer, \
concurrent.futures.ThreadPoolExecutor() as executor:
with ContextTimer() as timer, BailOutExecutor() as executor:
futures = set()
for master in self.masters:
future = executor.submit(self.__acquired_master, master)
Expand Down

0 comments on commit 1d29eeb

Please sign in to comment.