internal bool IsOkayForAction(IADDatabase db, AmServerName nodeName, AmDbActionCode actionCode, int coolingDuration) { bool result = true; if (actionCode == null) { return(true); } if (!actionCode.IsAutomaticFailureItem) { return(true); } if (db.ReplicationType == ReplicationType.None) { return(true); } lock (this.m_locker) { Dictionary <AmServerName, AmDbAttemptInfo> dictionary = null; if (this.m_dbMap.TryGetValue(db.Guid, out dictionary)) { AmDbAttemptInfo amDbAttemptInfo = null; if (dictionary.TryGetValue(nodeName, out amDbAttemptInfo)) { DateTime lastAttemptTime = amDbAttemptInfo.LastAttemptTime; if ((DateTime)ExDateTime.Now < lastAttemptTime.AddSeconds((double)coolingDuration)) { result = false; } } } } return(result); }
internal void MarkFailedTime(Guid dbGuid, AmServerName nodeName, AmDbActionCode actionCode) { lock (this.m_locker) { Dictionary <AmServerName, AmDbAttemptInfo> dictionary = null; if (!this.m_dbMap.TryGetValue(dbGuid, out dictionary)) { dictionary = new Dictionary <AmServerName, AmDbAttemptInfo>(); this.m_dbMap[dbGuid] = dictionary; } AmDbAttemptInfo value = new AmDbAttemptInfo(dbGuid, actionCode, (DateTime)ExDateTime.Now); dictionary[nodeName] = value; } }