diff options
author | Muriithi Frederick Muriuki | 2018-01-19 12:00:04 +0300 |
---|---|---|
committer | Muriithi Frederick Muriuki | 2018-01-19 12:00:04 +0300 |
commit | e185fd3895473e86f2c9fdf174a36b1d325a8c36 (patch) | |
tree | 7f72d42049439f39bdbcaa6eec07cc81400ff4d4 /wqflask/utility | |
parent | 4ae020160a9ae9c399fe338c9415897b26425201 (diff) | |
download | genenetwork2-e185fd3895473e86f2c9fdf174a36b1d325a8c36.tar.gz |
Delay after save for indexing
* Elasticsearch need a short delay after adding document for it to index
the document for subsequent access.
Diffstat (limited to 'wqflask/utility')
-rw-r--r-- | wqflask/utility/elasticsearch_tools.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/wqflask/utility/elasticsearch_tools.py b/wqflask/utility/elasticsearch_tools.py index 74db489b..c2c999ea 100644 --- a/wqflask/utility/elasticsearch_tools.py +++ b/wqflask/utility/elasticsearch_tools.py @@ -22,8 +22,10 @@ def get_user_by_unique_column(column_name, column_value): return user_details def save_user(user, user_id, index="users", doc_type="local"): + from time import sleep es = Elasticsearch([{ "host": ELASTICSEARCH_HOST , "port": ELASTICSEARCH_PORT }]) es.create(index, doc_type, body=user, id=user_id) + sleep(1) # Delay 1 second to allow indexing |