Acquire concurrent resources if exists. This behavior will fall back to wait with query_per_second if there are no concurrent resources.
(self)
| 87 | sys.stderr.flush() |
| 88 | |
| 89 | def acquire(self): |
| 90 | """Acquire concurrent resources if exists. |
| 91 | |
| 92 | This behavior will fall back to wait with query_per_second if there are |
| 93 | no concurrent resources. |
| 94 | """ |
| 95 | if hasattr(self, 'tokens'): |
| 96 | self.tokens.acquire() |
| 97 | else: |
| 98 | self.wait() |
| 99 | |
| 100 | def release(self): |
| 101 | """Release concurrent resources if acquired. |
no test coverage detected