(self, token: str)
| 235 | mod_time.sleep(sleep) |
| 236 | |
| 237 | def do_acquire(self, token: str) -> bool: |
| 238 | if self.timeout: |
| 239 | # convert to milliseconds |
| 240 | timeout = int(self.timeout * 1000) |
| 241 | else: |
| 242 | timeout = None |
| 243 | if self.redis.set(self.name, token, nx=True, px=timeout): |
| 244 | return True |
| 245 | return False |
| 246 | |
| 247 | def locked(self) -> bool: |
| 248 | """ |