public void GivenOptions_WhenCreatingFromOptions_ThenAssignProperties() { var actual = BatchCreationArguments.FromOptions( 1, new QueryTagIndexingOptions { BatchSize = 2, MaxParallelBatches = 3, }); Assert.Equal(1, actual.MaxWatermark); Assert.Equal(2, actual.BatchSize); Assert.Equal(3, actual.MaxParallelBatches); }
public async Task ReindexInstancesAsync( [OrchestrationTrigger] IDurableOrchestrationContext context, ILogger logger) { EnsureArg.IsNotNull(context, nameof(context)); logger = context.CreateReplaySafeLogger(logger); ReindexInput input = context.GetInput <ReindexInput>(); // The ID should be a GUID as generated by the trigger, but we'll assert here just to make sure! if (!context.HasInstanceGuid()) { return; } // Fetch the set of query tags that require re-indexing IReadOnlyList <ExtendedQueryTagStoreEntry> queryTags = await GetOperationQueryTagsAsync(context, input); logger.LogInformation( "Found {Count} extended query tag paths to re-index {{{TagPaths}}}.", queryTags.Count, string.Join(", ", queryTags.Select(x => x.Path))); List <int> queryTagKeys = queryTags.Select(x => x.Key).ToList(); if (queryTags.Count > 0) { IReadOnlyList <WatermarkRange> batches = await context.CallActivityWithRetryAsync <IReadOnlyList <WatermarkRange> >( nameof(GetInstanceBatchesV2Async), _options.ActivityRetryOptions, BatchCreationArguments.FromOptions(input.Completed?.Start - 1, _options)); if (batches.Count > 0) { // Note that batches are in reverse order because we start from the highest watermark var batchRange = new WatermarkRange(batches[^ 1].Start, batches[0].End);
public Task <IReadOnlyList <WatermarkRange> > GetInstanceBatchesAsync([ActivityTrigger] long?maxWatermark, ILogger logger) => GetInstanceBatchesV2Async(BatchCreationArguments.FromOptions(maxWatermark, _options), logger);