Skip to content

Commit

Permalink
Adapted to protect REFRESH_ALWAYS policy
Browse files Browse the repository at this point in the history
  • Loading branch information
ggovi committed Apr 3, 2020
1 parent 9c4a49f commit 05c7fca
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions CondCore/ESSources/plugins/CondDBESSource.cc
Expand Up @@ -347,14 +347,17 @@ void CondDBESSource::setIntervalFor(const EventSetupRecordKey& iKey,
}
//}
cond::Time_t lastTime = m_lastRun;
auto iR = m_refreshTimeForRecord.find(recordname);
bool refreshThisRecord = (iR != m_refreshTimeForRecord.end());
cond::Time_t defaultIovSize = cond::time::MAX_VAL;
cond::Time_t minDiffTime = 1;
if (refreshThisRecord) {
lastTime = cond::time::lumiTime(m_lastRun, m_lastLumi);
defaultIovSize = iR->second;
minDiffTime = defaultIovSize;
bool refreshThisRecord = false;
if (m_policy != REFRESH_ALWAYS) {
auto iR = m_refreshTimeForRecord.find(recordname);
refreshThisRecord = (iR != m_refreshTimeForRecord.end());
if (refreshThisRecord) {
lastTime = cond::time::lumiTime(m_lastRun, m_lastLumi);
defaultIovSize = iR->second;
minDiffTime = defaultIovSize;
}
}
bool doRefresh = false;
if (m_policy == REFRESH_EACH_RUN || m_policy == RECONNECT_EACH_RUN || refreshThisRecord) {
Expand All @@ -363,7 +366,8 @@ void CondDBESSource::setIntervalFor(const EventSetupRecordKey& iKey,
if (iRec != m_lastRecordRuns.end()) {
cond::Time_t lastRecordRun = iRec->second;
cond::Time_t diffTime = lastTime - lastRecordRun;
if( lastRecordRun > lastTime ) diffTime = lastRecordRun - lastTime;
if (lastRecordRun > lastTime)
diffTime = lastRecordRun - lastTime;
if (diffTime >= minDiffTime) {
// a refresh is required!
doRefresh = true;
Expand Down

0 comments on commit 05c7fca

Please sign in to comment.