public HttpJsonRequest AddReplicationStatusHeaders(string thePrimaryUrl, string currentUrl, ReplicationInformer replicationInformer, FailoverBehavior failoverBehavior, Action <NameValueCollection, string, string> handleReplicationStatusChanges) { if (thePrimaryUrl.Equals(currentUrl, StringComparison.InvariantCultureIgnoreCase)) { return(this); } if (replicationInformer.GetFailureCount(thePrimaryUrl) <= 0) { return(this); // not because of failover, no need to do this. } var lastPrimaryCheck = replicationInformer.GetFailureLastCheck(thePrimaryUrl); webRequest.Headers[Constants.RavenClientPrimaryServerUrl] = ToRemoteUrl(thePrimaryUrl); webRequest.Headers[Constants.RavenClientPrimaryServerLastCheck] = lastPrimaryCheck.ToString("s"); primaryUrl = thePrimaryUrl; operationUrl = currentUrl; HandleReplicationStatusChanges = handleReplicationStatusChanges; return(this); }
public HttpJsonRequest AddReplicationStatusHeaders(string thePrimaryUrl, string currentUrl, ReplicationInformer replicationInformer, FailoverBehavior failoverBehavior, Action <string, string, string> handleReplicationStatusChanges) { if (thePrimaryUrl.Equals(currentUrl, StringComparison.OrdinalIgnoreCase)) { return(this); } if (replicationInformer.GetFailureCount(thePrimaryUrl) <= 0) { return(this); // not because of failover, no need to do this. } var lastPrimaryCheck = replicationInformer.GetFailureLastCheck(thePrimaryUrl); httpClient.DefaultRequestHeaders.Add(Constants.RavenClientPrimaryServerUrl, ToRemoteUrl(thePrimaryUrl)); httpClient.DefaultRequestHeaders.Add(Constants.RavenClientPrimaryServerLastCheck, lastPrimaryCheck.ToString("s")); primaryUrl = thePrimaryUrl; operationUrl = currentUrl; HandleReplicationStatusChanges = handleReplicationStatusChanges; return(this); }
public HttpJsonRequest AddReplicationStatusHeaders(string thePrimaryUrl, string currentUrl, ReplicationInformer replicationInformer, FailoverBehavior failoverBehavior, Action<NameValueCollection, string, string> handleReplicationStatusChanges) { if (thePrimaryUrl.Equals(currentUrl, StringComparison.InvariantCultureIgnoreCase)) return this; if (replicationInformer.GetFailureCount(thePrimaryUrl) <= 0) return this; // not because of failover, no need to do this. var lastPrimaryCheck = replicationInformer.GetFailureLastCheck(thePrimaryUrl); webRequest.Headers.Add(Constants.RavenClientPrimaryServerUrl, ToRemoteUrl(thePrimaryUrl)); webRequest.Headers.Add(Constants.RavenClientPrimaryServerLastCheck, lastPrimaryCheck.ToString("s")); primaryUrl = thePrimaryUrl; operationUrl = currentUrl; HandleReplicationStatusChanges = handleReplicationStatusChanges; return this; }