BUG Make process_dirty_indexes act cleanly
process_dirty_indexes wasnt saving variant state or restoring or exit, because I thought it was only called at the end of a request and so didnt need to But tests call it regularly throughout a request. So now its clean and safe to call when-ever
This commit is contained in:
parent
f4fd71665a
commit
e5bf1473d6
|
@ -232,13 +232,13 @@ class SearchUpdater extends Object {
|
||||||
/**
|
/**
|
||||||
* Internal function. Process the passed list of dirty ids. Split from flush_dirty_indexes so it can be called both
|
* Internal function. Process the passed list of dirty ids. Split from flush_dirty_indexes so it can be called both
|
||||||
* directly and via messagequeue message.
|
* directly and via messagequeue message.
|
||||||
*
|
|
||||||
* WARNING: Changes state (subsite, stage) and doesn't reset it. Should only be called after request has ended
|
|
||||||
*/
|
*/
|
||||||
static function process_dirty_indexes($dirty) {
|
static function process_dirty_indexes($dirty) {
|
||||||
$indexes = FullTextSearch::get_indexes();
|
$indexes = FullTextSearch::get_indexes();
|
||||||
$dirtyindexes = array();
|
$dirtyindexes = array();
|
||||||
|
|
||||||
|
$originalState = SearchVariant::current_state();
|
||||||
|
|
||||||
foreach ($dirty as $base => $statefulids) {
|
foreach ($dirty as $base => $statefulids) {
|
||||||
if (!$statefulids) continue;
|
if (!$statefulids) continue;
|
||||||
|
|
||||||
|
@ -263,6 +263,8 @@ class SearchUpdater extends Object {
|
||||||
foreach ($dirtyindexes as $index) {
|
foreach ($dirtyindexes as $index) {
|
||||||
$indexes[$index]->commit();
|
$indexes[$index]->commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SearchVariant::activate_state($originalState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue