Commit e89532f9 authored by Donovan Watteau's avatar Donovan Watteau
Browse files

feat: Manually merge !8 in this test branch

parent 5cfc089b
......@@ -119,6 +119,9 @@ public:
unsigned int host_id,
unsigned int service_id) const;
// Other helpers
void clear_cache(bool log_enabled);
private:
typedef boost::unordered::unordered_map<unsigned int, std::string> group_name_map;
typedef boost::unordered::unordered_set<unsigned int> member_set_type;
......
......@@ -97,6 +97,9 @@ bool instance::process_instance(
<< ")";
_name = simplify(i.name);
if (! i.is_running) {
clear_cache(log_enabled);
}
return true;
}
......@@ -195,6 +198,9 @@ bool instance::process_host_group_member(
<< " to host group " << hgm.group_id << " on instance "
<< get_poller_id(hgm);
// In case group was deleted
_host_group_names[hgm.group_id] = simplify(hgm.group_name);
// Insert/Update
host_group_member_type::iterator found_host_group_member = _host_group_members.find(hgm.group_id);
if (found_host_group_member != _host_group_members.end()) {
......@@ -770,6 +776,26 @@ std::vector<std::pair<std::string, std::string> > instance::get_service_custom_v
return result;
}
/**
* Clears instance's configuration cache (empties all maps and vectors)
*
* @params[in] log_enabled Wether logging is enabled
*/
void instance::clear_cache(bool log_enabled) {
if (log_enabled)
logging::info(logging::medium)
<< "AMQP: clearing poller cache"
<< "(name: " << _name
<< (")");
_service_group_members.clear();
_host_group_members.clear();
_host_group_names.clear();
_service_group_names.clear();
_host_map.clear();
_service_map.clear();
_custom_variable_list.clear();
}
/**************************************
* *
* Private Methods *
......@@ -802,4 +828,4 @@ void instance::_internal_copy(instance const &other) {
// neb::instance info dump
_name = other._name;
return;
}
\ No newline at end of file
}
......@@ -92,7 +92,7 @@ bool (stream::* const stream::_neb_processing_table[])(
&stream::_process_service_group_member, // de_service_group_member
&stream::_process_service, // de_service = 23
&stream::_process_service_status, // de_service_status = 24
&stream::_process_unsupported_neb_event, // de_instance_configuration
&stream::_process_unsupported_neb_event, // de_instance_configuration = 25
};
#elif (CENTREON_BROKER_VERSION_MAJOR == 2)
bool (stream::* const stream::_neb_processing_table[])(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment