79109355

Date: 2024-10-21 09:16:45
Score: 2.5
Natty:
Report link

I have one more question

try
{
    var batchResult = await context.CallActivityAsync<BatchResultZara>("FetchZaraProductsBatch", new BatchRequest
    {
        Limit = limit,
        Offset = input.Offset,
        Query = input.Section,
        Section = input.Section,
        CorrelationId = context.InstanceId
    }, options: options);

    isLastPage = batchResult.IsLastPage;
    input.Offset = batchResult.LastPickedPosition;

    totalClothes = await context.CallActivityAsync<int>("AccumulateTotalClothes", new AccumulateRequest
    {
        PreviousTotal = totalClothes,
        BatchTotal = batchResult.ItemsSearched
    });

    if (!isLastPage)
    {
        context.ContinueAsNew(input); // This is the important bit.
    }
}
catch (Exception ex)
{
    logger.LogError($"Failed to fetch batch after retries. Error: {ex.Message}");
    throw;
}

// After all batches are processed, log via an activity function to ensure it's called once
await context.CallActivityAsync("LogFinalProcessingResults", new ProcessingResultInput
{
    Section = input.Section,
    TotalClothes = totalClothes
});

I want to accumulate all imported results and log only once at the end of durable but right now it seems that it is logged every time, how to achive that? @Andrew B

Reasons:
  • RegEx Blacklisted phrase (1): I want
  • Long answer (-1):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • User mentioned (1): @Andrew
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Redduke