diff options
Diffstat (limited to 'slobrok/src/vespa/slobrok/server/service_map_history.cpp')
-rw-r--r-- | slobrok/src/vespa/slobrok/server/service_map_history.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/slobrok/src/vespa/slobrok/server/service_map_history.cpp b/slobrok/src/vespa/slobrok/server/service_map_history.cpp index 3882a41bde5..5a2f8c6ff43 100644 --- a/slobrok/src/vespa/slobrok/server/service_map_history.cpp +++ b/slobrok/src/vespa/slobrok/server/service_map_history.cpp @@ -82,24 +82,29 @@ bool ServiceMapHistory::cancel(DiffCompletionHandler *handler) { return (removed > 0); } -void ServiceMapHistory::remove(const vespalib::string &name) { +void ServiceMapHistory::remove(const ServiceMapping &mapping) { { std::lock_guard guard(_lock); - auto iter = _map.find(name); + auto iter = _map.find(mapping.name); if (iter == _map.end()) { - LOG(warning, "already removed: %s", name.c_str()); - // already removed - return; + LOG(debug, "already removed: %s", mapping.name.c_str()); + return; // already removed } + LOG_ASSERT(iter->second == mapping.spec); _map.erase(iter); - _log.add(name); + _log.add(mapping.name); } notify_updated(); } -void ServiceMapHistory::update(const ServiceMapping &mapping) { +void ServiceMapHistory::add(const ServiceMapping &mapping) { { std::lock_guard guard(_lock); + auto iter = _map.find(mapping.name); + if (iter != _map.end() && iter->second == mapping.spec) { + // already ok + return; + } _map.insert_or_assign(mapping.name, mapping.spec); _log.add(mapping.name); } |