Future incompatibility with django-haystack 2.5
HyperKitty's search_indexes.py
module instantiates the haystack.management.commands.update_index.Command
class and calls its update_backend
method directly. In django_haystack 2.5 there is a new class attribute max_retries
which is the 'Maximum number of attempts to write to the backend when an error occurs.' When the update_index
command is called via django-admin
, max_retries
is given a default value of 5 if not specified, but when update_backend
is called directly, the class instance max_retries
attribute needs to be set. E.g.,
--- search_indexes.py 2016-03-19 00:00:19.162932643 +0000
+++ new_search_indexes.py 2016-04-23 03:49:38.797532984 +0000
@@ -73,4 +73,5 @@
update_cmd.workers = 0
update_cmd.commit = True
update_cmd.remove = remove
+ update_cmd.max_retries = 5
update_cmd.update_backend("hyperkitty", "default")
or to be really fancy
--- search_indexes.py 2016-03-19 00:00:19.162932643 +0000
+++ new_search_indexes.py 2016-04-23 03:54:48.073567581 +0000
@@ -73,4 +73,11 @@
update_cmd.workers = 0
update_cmd.commit = True
update_cmd.remove = remove
+ try:
+ from haystack.management.commands.update_index import \
+ DEFAULT_MAX_RETRIES
+ except ImportError:
+ pass
+ else:
+ update_cmd.max_retries = DEFAULT_MAX_RETRIES
update_cmd.update_backend("hyperkitty", "default")