toastdriven/django-haystack — pull request #550 by adamfast (2012-04-11 16:58:10+00:00)
Title: Fixes issue with database connection rug pulled out from under code when using multiprocessing

All core tests pass with this change (and before this change) but I have not run the backend-specific tests. I'm not sure what the solr schema is and get errors on all of them when attempting to run.

When using update_index with --workers I get the psycopg2 server closed error as soon as it switches apps / goes to get a count on the next app's queryset.

The only test on update_index with a value for workers (tests.solr_tests.tests.management_commands.ManagementCommandTestCase.test_multiprocessing) is probably the one to watch here. Enough things in the command "change" with workers set to nonzero that it might be worthwhile adding a copy of the tests that runs with --workers=1 also?

It also looks like the update_index tests only use a single app (sorry if I'm missing something) so since this bug appears when the update goes from one app to the next that might explain why it didn't pop up with all tests passing?