File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -140,8 +140,12 @@ def offline_ann(index_name, doc_dir):
140
140
use_gpu = use_gpu ,
141
141
embed_title = args .embed_title ,
142
142
)
143
- # Writing docs may take a while. so waitting for 3 seconds for writing docs to be completed.
144
- time .sleep (3 )
143
+ # Writing docs may take a while. so waitting until writing docs to be completed.
144
+ document_count = document_store .get_document_count ()
145
+ while document_count == 0 :
146
+ time .sleep (1 )
147
+ print ("Waiting for writing docs to be completed." )
148
+ document_count = document_store .get_document_count ()
145
149
# 建立索引库
146
150
document_store .update_embeddings (retriever )
147
151
Original file line number Diff line number Diff line change @@ -94,8 +94,12 @@ def offline_ann(index_name, doc_dir):
94
94
query_type = "image" ,
95
95
document_embedding_models = {"text" : args .document_embedding_model },
96
96
)
97
- # Writing docs may take a while. so waitting for 3 seconds for writing docs to be completed.
98
- time .sleep (3 )
97
+ # Writing docs may take a while. so waitting until writing docs to be completed.
98
+ document_count = document_store .get_document_count ()
99
+ while document_count == 0 :
100
+ time .sleep (1 )
101
+ print ("Waiting for writing docs to be completed." )
102
+ document_count = document_store .get_document_count ()
99
103
# 建立索引库
100
104
document_store .update_embeddings (retriever_mm )
101
105
You can’t perform that action at this time.
0 commit comments