Problem/Motivation
If search_api_index_specific_items_delayed()
is called it registers _search_api_index_queued_items()
as a drupal shutdown callback.
And it does this as long as the static variable $queue
is empty.
The problem is if I call search_api_index_specific_items_delayed()
to check if there's a queue, I omit the index and ids parameter. This means an empty queue is created and the shutdown function is registered.
This leads to an endless loop since _search_api_index_queued_items()
also calls search_api_index_specific_items_delayed()
to fetch the queue - since the queue is empty another shutdown callback is registered. Because the whole thing works with a reference the loop over the shutdown function gets immediately a new callback, which will add also a new callback and so on.
Proposed resolution
Add another static variable, that indicates whether the shutdown callback is registered.
Remaining tasks
Review
User interface changes
none
API changes
none
Comment | File | Size | Author |
---|---|---|---|
search_api-prevent-endlessloop-in-search_api_index_specific_items_delayed.patch | 691 bytes | das-peter | |
Comments
Comment #1
drunken monkeyThanks for spotting and fixing that! Seems sensible.
Committed.