Skip to content

Hide all the timeouts within one transaction for RavenDB #105

@lailabougria

Description

@lailabougria

Already tried to set this up for Raven3, but couldn't get it fully functional:

public async Task<bool> HideTimeouts(DateTime cutoffDate)
{
      var cutoffDateParameter = cutoffDate.ToString("YYYY-MM-DDThh:mm:ssZ");
      cutoffDateParameter = cutoffDateParameter.Replace(":", "\\:"); // escape characters for lucene
      var dateRangeSpecification = $"Time:[{cutoffDateParameter} TO *]";
      var patch = new Patch()
      {
           Script = $"this.OwningTimeoutManager = this.OwningTimeoutManager.substr({RavenConstants.MigrationOngoingPrefix.Length});",
          Values = new { }
      };

      var patchCommand = JsonConvert.SerializeObject(patch);
      var url = $"{serverUrl}/databases{databaseName}/bulk_docs/TimeoutsIndex?query={Uri.EscapeDataString(dateRangeSpecification)}&allowStale=false";

      var encoded = Encoding.UTF8.GetBytes(patchCommand);
      var compressed = Compress(encoded);
      using var httpContent = new StringContent(Convert.ToBase64String(compressed), Encoding.UTF8, "application/json");
      using var request = new HttpRequestMessage(new HttpMethod("EVAL"), url){  Content = httpContent};
      var result = await httpClient.SendAsync(request);

      return result.IsSuccessStatusCode;
 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions