Skip to content

Commit 1ab44b5

Browse files
committed
update_index: wait for all pool workers to finish
There was a race condition where update_index() would return before all of the workers had finished updating Solr. This manifested itself most frequently as Travis failures for the multiprocessing test (see django-haystack#1001).
1 parent 1aa6f67 commit 1ab44b5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

haystack/management/commands/update_index.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,8 @@ def update_backend(self, label, using):
242242
if self.workers > 0:
243243
pool = multiprocessing.Pool(self.workers)
244244
pool.map(worker, ghetto_queue)
245-
pool.terminate()
245+
pool.close()
246+
pool.join()
246247

247248
if self.remove:
248249
if self.start_date or self.end_date or total <= 0:

0 commit comments

Comments
 (0)