MCPcopy
hub / github.com/redis/redis-py / waitForIndex

Method waitForIndex

tests/test_asyncio/test_search.py:66–90  ·  view source on GitHub ↗
(env, idx, timeout=None)

Source from the content-addressed store, hash-verified

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):

Callers 12

test_clientMethod · 0.45
test_stopwordsMethod · 0.45
test_filtersMethod · 0.45
test_drop_indexMethod · 0.45
test_no_indexMethod · 0.45
test_summarizeMethod · 0.45
test_tagsMethod · 0.45
test_spell_checkMethod · 0.45
test_withsuffixtrieMethod · 0.45

Calls 2

execute_commandMethod · 0.45
sleepMethod · 0.45

Tested by

no test coverage detected