// ReSharper disable once UnusedMember.Global public async Task PublishReleaseFiles( [QueueTrigger(PublishReleaseFilesQueue)] PublishReleaseFilesMessage message, ExecutionContext executionContext, ILogger logger) { logger.LogInformation($"{executionContext.FunctionName} triggered: {message}"); var immediate = await IsImmediate(message); var published = new List <(Guid ReleaseId, Guid ReleaseStatusId)>(); foreach (var(releaseId, releaseStatusId) in message.Releases) { await UpdateStage(releaseId, releaseStatusId, Started); try { _publishingService.PublishReleaseFilesAsync(releaseId).Wait(); published.Add((releaseId, releaseStatusId)); } catch (Exception e) { logger.LogError(e, $"Exception occured while executing {executionContext.FunctionName}"); logger.LogError(e.StackTrace); await UpdateStage(releaseId, releaseStatusId, Failed, new ReleaseStatusLogMessage($"Exception in files stage: {e.Message}")); } } try { if (immediate) { await _queueService.QueuePublishReleaseDataMessagesAsync(published); } else { await _queueService.QueueGenerateReleaseContentMessageAsync(published); } foreach (var(releaseId, releaseStatusId) in published) { await UpdateStage(releaseId, releaseStatusId, Complete); } } catch (Exception e) { logger.LogError(e, $"Exception occured while executing {executionContext.FunctionName}"); logger.LogError(e.StackTrace); } logger.LogInformation($"{executionContext.FunctionName} completed"); }