Remove deadlock in db_ido

refs #9017
This commit is contained in:
Gunnar Beutner 2015-04-14 15:09:50 +02:00
parent a3065d8b79
commit e4f4c6bc2d
2 changed files with 6 additions and 5 deletions

View File

@ -45,7 +45,7 @@ void DbEvents::StaticInitialize(void)
/* Status */
Checkable::OnCommentAdded.connect(boost::bind(&DbEvents::AddComment, _1, _2));
Checkable::OnCommentRemoved.connect(boost::bind(&DbEvents::RemoveComment, _1, _2));
Checkable::OnDowntimeAdded.connect(boost::bind(&DbEvents::AddDowntime, _1, _2));
Checkable::OnDowntimeAdded.connect(boost::bind(&DbEvents::AddDowntime, _1, _2, true));
Checkable::OnDowntimeRemoved.connect(boost::bind(&DbEvents::RemoveDowntime, _1, _2));
Checkable::OnDowntimeTriggered.connect(boost::bind(&DbEvents::TriggerDowntime, _1, _2));
Checkable::OnAcknowledgementSet.connect(boost::bind(&DbEvents::AddAcknowledgement, _1, _4));
@ -469,17 +469,18 @@ void DbEvents::AddDowntimes(const Checkable::Ptr& checkable)
ObjectLock olock(downtimes);
BOOST_FOREACH(const Dictionary::Pair& kv, downtimes) {
AddDowntime(checkable, kv.second);
AddDowntime(checkable, kv.second, false);
}
}
void DbEvents::AddDowntime(const Checkable::Ptr& checkable, const Downtime::Ptr& downtime)
void DbEvents::AddDowntime(const Checkable::Ptr& checkable, const Downtime::Ptr& downtime, bool remove_existing)
{
/*
* make sure to delete any old downtime to avoid multiple inserts from
* configured ScheduledDowntime dumps and CreateNextDowntime() calls
*/
RemoveDowntime(checkable, downtime);
if (remove_existing)
RemoveDowntime(checkable, downtime);
AddDowntimeInternal(checkable, downtime, false);
}

View File

@ -94,7 +94,7 @@ public:
static void AddComment(const Checkable::Ptr& checkable, const Comment::Ptr& comment);
static void RemoveComment(const Checkable::Ptr& checkable, const Comment::Ptr& comment);
static void AddDowntime(const Checkable::Ptr& checkable, const Downtime::Ptr& downtime);
static void AddDowntime(const Checkable::Ptr& checkable, const Downtime::Ptr& downtime, bool remove_existing);
static void RemoveDowntime(const Checkable::Ptr& checkable, const Downtime::Ptr& downtime);
static void TriggerDowntime(const Checkable::Ptr& checkable, const Downtime::Ptr& downtime);