Skip to content

Commit

Permalink
Wait for meilisearch client to be healthy
Browse files Browse the repository at this point in the history
Fixes #28
  • Loading branch information
mr-pennyworth committed Jun 26, 2024
1 parent f9d7906 commit c6bc1eb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,7 @@ Subsequent searches should be snappy
<key>variablesdontexport</key>
<array/>
<key>version</key>
<string>0.2.12</string>
<string>0.2.13</string>
<key>webaddress</key>
<string>https://github.com/mr-pennyworth/alfred-better-dictionaries</string>
</dict>
Expand Down
7 changes: 5 additions & 2 deletions pyapp/BetterDict.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,11 @@ def search_client(db_path):
if not is_search_server_up():
start_search_server(db_path)
while not is_search_server_up():
time.sleep(0.01)
return meilisearch.Client(f"http://{SEARCH_IP}:{SEARCH_PORT}")
time.sleep(0.1)
client = meilisearch.Client(f"http://{SEARCH_IP}:{SEARCH_PORT}")
while not client.is_healthy():
time.sleep(0.1)
return client


def create_index(dict_id, db_path):
Expand Down

0 comments on commit c6bc1eb

Please sign in to comment.