Refresh the lock's expiration time if this instance owns the lock. Returns True if the expiration was successfully extended.
(self)
| 43 | return result is not None |
| 44 | |
| 45 | def refresh(self) -> bool: |
| 46 | """ |
| 47 | Refresh the lock's expiration time if this instance owns the lock. |
| 48 | Returns True if the expiration was successfully extended. |
| 49 | """ |
| 50 | current_value = self.redis_client.get(self.lock_key) |
| 51 | if current_value and current_value == self.lock_token: |
| 52 | self.redis_client.expire(self.lock_key, self.lock_timeout) |
| 53 | self.has_lock = False |
| 54 | return True |
| 55 | return False |
| 56 | |
| 57 | def release(self) -> bool: |
| 58 | """ |
no test coverage detected