From 53f3b1ca07a3c323cb135c3b182f44c473455355 Mon Sep 17 00:00:00 2001 From: Will Kahn-Greene Date: Wed, 25 Jan 2012 10:51:04 -0500 Subject: [PATCH] Fix ES indexing timeout I missed a spot earlier when I changed indexing to use an ES with timeout=settings.ES_INDEXING_TIMEOUT. This only affects incremental indexing where it gets its own ES. In the process of fixing that one line, I renamed es_utils.get_es to es_utils.get_indexing_es so it's clearer what it's for. --- apps/search/es_utils.py | 4 ++-- apps/search/models.py | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/search/es_utils.py b/apps/search/es_utils.py index 82278307b06..e4cd13ad7df 100644 --- a/apps/search/es_utils.py +++ b/apps/search/es_utils.py @@ -38,8 +38,8 @@ def get_doctype_stats(): return stats -def get_es(**kwargs): - """Returns a fresh ES instance +def get_indexing_es(**kwargs): + """Returns a fresh ES instance for indexing Defaults for these arguments come from settings. Specifying them in the function call will override the default. diff --git a/apps/search/models.py b/apps/search/models.py index 8b919b812cd..6edb79b799d 100644 --- a/apps/search/models.py +++ b/apps/search/models.py @@ -101,7 +101,7 @@ def index_all(cls, percent=100): 100--e.g. all of them. """ - es = es_utils.get_es() + es = es_utils.get_indexing_es() doc_type = cls._meta.db_table index = settings.ES_INDEXES['default'] @@ -168,7 +168,9 @@ def index(cls, document, bulk=False, force_insert=False, refresh=False, return if es is None: - es = elasticutils.get_es() + # Use the es_utils get_es because it uses + # ES_INDEXING_TIMEOUT. + es = es_utils.get_indexing_es() index = settings.ES_INDEXES['default'] doc_type = cls._meta.db_table