1
0
mirror of https://github.com/djohnlewis/stackdump synced 2024-12-04 23:17:37 +00:00

Fixed a bug where import_site will loop forever if a non-SolrError exception is encountered.

This commit is contained in:
Samuel Lai 2014-03-04 15:47:11 +11:00
parent f79df598d3
commit ae6e10e6c4

View File

@ -538,13 +538,17 @@ class PostContentHandler(xml.sax.ContentHandler):
By default, they are committed immediately. Set the ``commit`` argument
to False to disable this behaviour.
This function will loop if a SolrError is encountered to allow the user
to retry the commit without having to start again from the beginning,
e.g. if the Solr instance stops responding.
"""
while True:
try:
self.solr.add(questions, commit=commit)
break
except SolrError, e:
print('An exception occurred while committing questions - ')
print('A Solr error occurred while committing questions - ')
traceback.print_exc(file=sys.stdout)
print('')
while True:
@ -557,6 +561,8 @@ class PostContentHandler(xml.sax.ContentHandler):
break
else:
raise
except:
raise
def commit_all_questions(self):
"""