(env, idx, timeout=None)
| 64 | |
| 65 | @staticmethod |
| 66 | async def waitForIndex(env, idx, timeout=None): |
| 67 | delay = 0.1 |
| 68 | while True: |
| 69 | try: |
| 70 | res = await env.execute_command("FT.INFO", idx) |
| 71 | if int(res[res.index("indexing") + 1]) == 0: |
| 72 | break |
| 73 | except ValueError: |
| 74 | break |
| 75 | except AttributeError: |
| 76 | try: |
| 77 | if int(res["indexing"]) == 0: |
| 78 | break |
| 79 | except ValueError: |
| 80 | break |
| 81 | except ResponseError: |
| 82 | # index doesn't exist yet |
| 83 | # continue to sleep and try again |
| 84 | pass |
| 85 | |
| 86 | await asyncio.sleep(delay) |
| 87 | if timeout is not None: |
| 88 | timeout -= delay |
| 89 | if timeout <= 0: |
| 90 | break |
| 91 | |
| 92 | @staticmethod |
| 93 | def getClient(decoded_r: redis.Redis): |
no test coverage detected