Пример #1
0
		private void IncrementFailureCount(RavenConnectionStringOptions destination)
		{
			var jsonDocument = docDb.Get(ReplicationConstants.RavenReplicationDestinationsBasePath + EscapeDestinationName(destination), null);
			var failureInformation = new DestinationFailureInformation {Destination = destination.Url};
			if (jsonDocument != null)
			{
				failureInformation = jsonDocument.DataAsJson.JsonDeserialization<DestinationFailureInformation>();
			}
			failureInformation.FailureCount += 1;
			docDb.Put(ReplicationConstants.RavenReplicationDestinationsBasePath + EscapeDestinationName(destination), null,
					  RavenJObject.FromObject(failureInformation), new RavenJObject(), null);
		}
Пример #2
0
        private void RecordFailure(string url, string lastError)
        {
            var stats = destinationStats.GetOrAdd(url, new DestinationStats { Url = url });
            var failureCount = Interlocked.Increment(ref stats.FailureCountInternal);
            stats.LastFailureTimestamp = SystemTime.UtcNow;

            if (stats.FirstFailureInCycleTimestamp == null)
                stats.FirstFailureInCycleTimestamp = SystemTime.UtcNow;

            if (string.IsNullOrWhiteSpace(lastError) == false)
                stats.LastError = lastError;

            var jsonDocument = docDb.Documents.Get(Constants.RavenReplicationDestinationsBasePath + EscapeDestinationName(url), null);
            var failureInformation = new DestinationFailureInformation { Destination = url };
            if (jsonDocument != null)
            {
                failureInformation = jsonDocument.DataAsJson.JsonDeserialization<DestinationFailureInformation>();
                // we only want to update this once a minute, otherwise we have churn with starting replication
                // because we are writing a failure document
                if ((SystemTime.UtcNow - jsonDocument.LastModified.GetValueOrDefault()).TotalMinutes < 1)
                {
                    return;
                }
            }
            failureInformation.FailureCount = failureCount;
            docDb.Documents.Put(Constants.RavenReplicationDestinationsBasePath + EscapeDestinationName(url), null,
                      RavenJObject.FromObject(failureInformation), new RavenJObject(), null);
        }
Пример #3
0
 private void IncrementFailureCount(string destination)
 {
     var jsonDocument = docDb.Get(ReplicationConstants.RavenReplicationDestinationsBasePath + destination, null);
     var failureInformation = new DestinationFailureInformation {Destination = destination};
     if (jsonDocument != null)
     {
         failureInformation = jsonDocument.DataAsJson.JsonDeserialization<DestinationFailureInformation>();
     }
     failureInformation.FailureCount += 1;
     docDb.Put(ReplicationConstants.RavenReplicationDestinationsBasePath + destination, null,
               JObject.FromObject(failureInformation), new JObject(), null);
 }
Пример #4
0
		private void RecordFailure(string url, string lastError)
		{
			var stats = destinationStats.GetOrAdd(url, new DestinationStats { Url = url });
			Interlocked.Increment(ref stats.FailureCountInternal);
			stats.LastFailureTimestamp = SystemTime.UtcNow;
			if (string.IsNullOrWhiteSpace(lastError) == false)
				stats.LastError = lastError;

			var jsonDocument = docDb.Documents.Get(Constants.RavenReplicationDestinationsBasePath + EscapeDestinationName(url), null);
			var failureInformation = new DestinationFailureInformation { Destination = url };
			if (jsonDocument != null)
			{
				failureInformation = jsonDocument.DataAsJson.JsonDeserialization<DestinationFailureInformation>();
			}
			failureInformation.FailureCount += 1;
			docDb.Documents.Put(Constants.RavenReplicationDestinationsBasePath + EscapeDestinationName(url), null,
					  RavenJObject.FromObject(failureInformation), new RavenJObject(), null);
		}
Пример #5
0
		private void IncrementFailureCount(ReplicationStrategy destination, string lastError)
		{
			var failureCount = replicationFailureStats.GetOrAdd(destination.ConnectionStringOptions.Url);
			Interlocked.Increment(ref failureCount.Count);
			failureCount.Timestamp = SystemTime.UtcNow;
			if (string.IsNullOrWhiteSpace(lastError) == false)
				failureCount.LastError = lastError;

			var jsonDocument = docDb.Get(Constants.RavenReplicationDestinationsBasePath + EscapeDestinationName(destination.ConnectionStringOptions.Url), null);
			var failureInformation = new DestinationFailureInformation { Destination = destination.ConnectionStringOptions.Url };
			if (jsonDocument != null)
			{
				failureInformation = jsonDocument.DataAsJson.JsonDeserialization<DestinationFailureInformation>();
			}
			failureInformation.FailureCount += 1;
			docDb.Put(Constants.RavenReplicationDestinationsBasePath + EscapeDestinationName(destination.ConnectionStringOptions.Url), null,
					  RavenJObject.FromObject(failureInformation), new RavenJObject(), null);
		}