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:
parent
f79df598d3
commit
ae6e10e6c4
@ -538,13 +538,17 @@ class PostContentHandler(xml.sax.ContentHandler):
|
|||||||
|
|
||||||
By default, they are committed immediately. Set the ``commit`` argument
|
By default, they are committed immediately. Set the ``commit`` argument
|
||||||
to False to disable this behaviour.
|
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:
|
while True:
|
||||||
try:
|
try:
|
||||||
self.solr.add(questions, commit=commit)
|
self.solr.add(questions, commit=commit)
|
||||||
break
|
break
|
||||||
except SolrError, e:
|
except SolrError, e:
|
||||||
print('An exception occurred while committing questions - ')
|
print('A Solr error occurred while committing questions - ')
|
||||||
traceback.print_exc(file=sys.stdout)
|
traceback.print_exc(file=sys.stdout)
|
||||||
print('')
|
print('')
|
||||||
while True:
|
while True:
|
||||||
@ -557,6 +561,8 @@ class PostContentHandler(xml.sax.ContentHandler):
|
|||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
|
except:
|
||||||
|
raise
|
||||||
|
|
||||||
def commit_all_questions(self):
|
def commit_all_questions(self):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user