Skip to content

Commit

Permalink
add the reload call and run refresh 2x times
Browse files Browse the repository at this point in the history
  • Loading branch information
fpurcell committed Sep 12, 2016
1 parent 3945169 commit 2690a2f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
7 changes: 4 additions & 3 deletions config/app.ini
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ bike_url : http://app.socialbicycles.com/map?bike_id={}


[solr]
url : http://localhost:{}/solr/core/update
#url : http://maps7.trimet.org:{}/solr/core/update
ports : [10880, 10780, 10980, 11080]
url : http://localhost:{}/solr/core/update
reload : http://localhost:{}/solr/admin/cores?action=RELOAD&core=core
#url : http://maps7.trimet.org:{}/solr/core/update
ports : [10880, 10780, 10980, 11080]
10 changes: 9 additions & 1 deletion ott/loader/solr/solr_loader.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import logging
import urllib2
log = logging.getLogger(__file__)

from ott.utils import file_utils
Expand Down Expand Up @@ -96,6 +97,7 @@ def _process_file(self, file_name, do_optimize):

# step 2: grab SOLR properties for url (and optionally the web ports where SOLR instance(es) run
url = self.config.get('url')
reload_url = self.config.get('reload')
ports = None
if ":{}" in url or ":{0}" in url:
ports = self.config.get_list('ports', def_val='80')
Expand All @@ -109,7 +111,13 @@ def _process_file(self, file_name, do_optimize):
# step 3b: now refresh all instances of SOLR
for p in ports:
u = url.format(p)
self.commit(u)
ru = reload_url.format(p) if reload_url else None
for _ in range(2):
self.commit(u)
if do_optimize:
self.optimize(u)
if ru:
urllib2.urlopen(ru)
else:
# step 3c: update and refresh the single instance of SOLR
is_success = self.update_index(url, solr_xml_file_path, do_optimize)
Expand Down

0 comments on commit 2690a2f

Please sign in to comment.