diff --git a/zero.Core/Persistence/RavenConstants.cs b/zero.Core/Persistence/RavenConstants.cs new file mode 100644 index 00000000..698754c2 --- /dev/null +++ b/zero.Core/Persistence/RavenConstants.cs @@ -0,0 +1,9 @@ +namespace zero.Persistence; + +public static partial class RavenConstants +{ + public static partial class Indexing + { + public const string ThrottlingTimeIntervalInMs = "Indexing.Throttling.TimeIntervalInMs"; + } +} \ No newline at end of file diff --git a/zero.Core/Persistence/RavenIndexExtensions.cs b/zero.Core/Persistence/RavenIndexExtensions.cs new file mode 100644 index 00000000..016894fc --- /dev/null +++ b/zero.Core/Persistence/RavenIndexExtensions.cs @@ -0,0 +1,11 @@ +using Raven.Client.Documents.Indexes; + +namespace zero.Persistence; + +public static class RavenIndexExtensions +{ + public static void Throttle(this AbstractCommonApiForIndexes index, TimeSpan delay) + { + index.Configuration[RavenConstants.Indexing.ThrottlingTimeIntervalInMs] = delay.TotalMilliseconds.ToString(); + } +}