HandleRequestBufferingErrors() private method

private HandleRequestBufferingErrors ( Exception e, ReplicationStrategy destination ) : void
e System.Exception
destination ReplicationStrategy
return void
Ejemplo n.º 1
0
        private void ReplicateSingleTransformer(ReplicationStrategy destination, TransformerDefinition definition)
        {
            try
            {
                var clonedTransformer = definition.Clone();
                clonedTransformer.TransfomerId = 0;

                var url = destination.ConnectionStringOptions.Url + "/transformers/" + Uri.EscapeUriString(definition.Name) + "?" + GetDebugInformation();
                var replicationRequest = httpRavenRequestFactory.Create(url, HttpMethod.Put, destination.ConnectionStringOptions, replication.GetRequestBuffering(destination));
                replicationRequest.Write(RavenJObject.FromObject(clonedTransformer));
                replicationRequest.ExecuteRequest();
            }
            catch (Exception e)
            {
                replication.HandleRequestBufferingErrors(e, destination);

                Log.WarnException("Could not replicate transformer " + definition.Name + " to " + destination.ConnectionStringOptions.Url, e);
            }
        }
Ejemplo n.º 2
0
        private void ReplicateIndexDeletionIfNeeded(List <JsonDocument> indexTombstones, ReplicationStrategy destination, Dictionary <string, int> replicatedIndexTombstones)
        {
            if (indexTombstones.Count == 0)
            {
                return;
            }

            foreach (var tombstone in indexTombstones)
            {
                try
                {
                    int value;
                    //In case the index was recreated under the same name we will increase the destination count for this tombstone
                    //As if we sent the delete request but without actually sending the request, ending with a NOOP and deleting the index tombstone.
                    if (database.IndexStorage.HasIndex(tombstone.Key))
                    {
                        replicatedIndexTombstones.TryGetValue(tombstone.Key, out value);
                        replicatedIndexTombstones[tombstone.Key] = value + 1;
                        continue;
                    }

                    var url = string.Format("{0}/indexes/{1}?{2}", destination.ConnectionStringOptions.Url, Uri.EscapeUriString(tombstone.Key), GetDebugInformation());
                    var replicationRequest = httpRavenRequestFactory.Create(url, HttpMethods.Delete, destination.ConnectionStringOptions, replication.GetRequestBuffering(destination));
                    replicationRequest.Write(RavenJObject.FromObject(emptyRequestBody));
                    replicationRequest.ExecuteRequest();
                    Log.Info("Replicated index deletion (index name = {0})", tombstone.Key);

                    replicatedIndexTombstones.TryGetValue(tombstone.Key, out value);
                    replicatedIndexTombstones[tombstone.Key] = value + 1;
                }
                catch (Exception e)
                {
                    replication.HandleRequestBufferingErrors(e, destination);

                    Log.ErrorException(string.Format("Failed to replicate index deletion (index name = {0})", tombstone.Key), e);
                }
            }
        }