Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,34 @@ public async Task PublishSqlProject(IResourceWithDacpac resource, IResourceWithC

try
{
List<Task> waitingTasks = [];
if (target is SqlServerDatabaseResource)
{
waitingTasks.Add(resourceNotificationService.WaitForDependenciesAsync(target, cancellationToken));
}

if (resource.TryGetAnnotationsOfType<WaitAnnotation>(out var waitAnnotations))
{
foreach (var waitAnnotation in waitAnnotations)
{
if (waitAnnotation.WaitType == WaitType.WaitUntilHealthy)
{
waitingTasks.Add(resourceNotificationService.WaitForResourceHealthyAsync(waitAnnotation.Resource.Name, cancellationToken));
continue;
}

var targetState = waitAnnotation.WaitType switch
{
WaitType.WaitForCompletion => KnownResourceStates.Finished,
WaitType.WaitUntilStarted => KnownResourceStates.Starting,
_ => throw new NotSupportedException($"Wait type {waitAnnotation.WaitType} is not supported."),
};
waitingTasks.Add(resourceNotificationService.WaitForResourceAsync(waitAnnotation.Resource.Name, targetState, cancellationToken));
}
}

await Task.WhenAll(waitingTasks);
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If waitingTasks is empty, Task.WhenAll will return immediately, which is correct behavior. However, if the target is not a SqlServerDatabaseResource and there are no wait annotations, this may proceed without waiting for any dependencies when it should. Consider whether waiting should be mandatory for all resource types.

Copilot uses AI. Check for mistakes.

var dacpacPath = resource.GetDacpacPath();
if (!Path.IsPathRooted(dacpacPath))
{
Expand Down
Loading