I was deploying beans from my staging site to production but I kept getting a request time out error. It looks like when calling drupal_http_request the max timeout of 30 seconds was being reached. So I investigated the issue further.
I noticed if I commented out menu_rebuild in bean_reset that the time to create a bean would drop from 30 seconds to about 5 seconds. I was wondering what is the rationale for having menu_rebuild inside bean_reset which itself is called in bean_save. So every time I save a bean menu_rebuild is being called. This seems like an outrageously expensive operation particularly for large sites.
Looking through the previous commits it seems menu_rebuild was only added in bean_reset in order to support the following code in hook_menu:
foreach (bean_get_types() as $type) {
if (!empty($type)) {
$items['block/add/' . $type->buildURL()] = array(
'title' => $type->getLabel(),
'title callback' => 'check_plain',
'page callback' => 'bean_add',
'page arguments' => array($type->type),
'access arguments' => array('create any ' . $type->type . ' bean'),
'file' => 'includes/bean.pages.inc',
);
}
}
Is there anything we can do to fix this because it makes saving beans very slow, as well as deploying them and leveraging them in an install profile. Basically anytime bean->save is called.
Comments
Comment #1
sylus commentedModifying title.
Comment #2
spotzero commentedThis is likely related to this issue: https://drupal.org/node/2060831
Comment #3
spotzero commentedIf the menu_rebuild is only required to build the menu paths for the bean types, as the issue #1850814 (https://drupal.org/node/1850814) would suggest, then if this menu entry was replaced with something like:
Then you'd just need to implement the two extra callbacks mentioned; "bean_type_title" and "bean_type_access".
Does this approach seem sound?
Comment #4
ottawadeveloper commentedmenu_rebuild() also supports Field UI as per #1850814: After creating a new bean type, cache clear is required to manage fields of a bean
Comment #5
sylus commentedAt this point this is a duplicate of: https://drupal.org/node/2060831 so closing.