63 references to WaitBehavior
Aspire.Hosting (39)
ApplicationModel\ResourceNotificationService.cs (20)
37internal WaitBehavior DefaultWaitBehavior { get; set; } 58DefaultWaitBehavior = WaitBehavior.StopOnResourceUnavailable; 77DefaultWaitBehavior = serviceProvider.GetService<IOptions<ResourceNotificationServiceOptions>>()?.Value.DefaultWaitBehavior ?? WaitBehavior.StopOnResourceUnavailable; 147private async Task WaitUntilHealthyAsync(IResource resource, IResource dependency, WaitBehavior waitBehavior, CancellationToken cancellationToken, Func<string, Task>? onDependencyReady = null) 205/// control this behavior use <see cref="WaitForResourceHealthyAsync(string, WaitBehavior, CancellationToken)"/> 229/// <see cref="WaitBehavior"/> controls how the wait operation behaves when the resource 233/// When <see cref="WaitBehavior.WaitOnResourceUnavailable"/> is specified the wait operation 237/// When <see cref="WaitBehavior.StopOnResourceUnavailable"/> is specified the wait operation 242public async Task<ResourceEvent> WaitForResourceHealthyAsync(string resourceName, WaitBehavior waitBehavior, CancellationToken cancellationToken = default) 244if (waitBehavior == WaitBehavior.StopOnResourceUnavailable && !TryGetCurrentState(resourceName, out _)) 315internal static bool ShouldYieldHealthyWait(WaitBehavior waitBehavior, CustomResourceSnapshot snapshot) => 318WaitBehavior.WaitOnResourceUnavailable => snapshot.HealthStatus == HealthStatus.Healthy, 319WaitBehavior.StopOnResourceUnavailable => snapshot.HealthStatus == HealthStatus.Healthy || 401private async Task WaitUntilStateAsync(IResource resource, IResource dependency, WaitBehavior waitBehavior, 428if (waitBehavior == WaitBehavior.StopOnResourceUnavailable) 463static bool IsContinuableState(WaitBehavior waitBehavior, CustomResourceSnapshot snapshot) => 466WaitBehavior.WaitOnResourceUnavailable => snapshot.State?.Text == KnownResourceStates.Running, 467WaitBehavior.StopOnResourceUnavailable => snapshot.State?.Text == KnownResourceStates.Running || 477private async Task WaitUntilStartedAsync(IResource resource, IResource dependency, WaitBehavior waitBehavior, CancellationToken cancellationToken, Func<string, Task>? onDependencyReady = null) 1505public WaitBehavior DefaultWaitBehavior { get; set; }
ApplicationModel\WaitAnnotation.cs (1)
33public WaitBehavior? WaitBehavior { get; init; }
Backchannel\AuxiliaryBackchannelRpcTarget.cs (1)
703re => ResourceNotificationService.ShouldYieldHealthyWait(WaitBehavior.StopOnResourceUnavailable, re.Snapshot),
Backchannel\DashboardUrlsHelper.cs (1)
58WaitBehavior.StopOnResourceUnavailable,
Diagnostics\ProfilingTelemetry.cs (2)
483public static ActivityScope StartResourceWaitForDependency(IConfiguration? configuration, IResource resource, IResource dependency, WaitType waitType, WaitBehavior? waitBehavior) 993public void SetDependencyWait(IResource resource, IResource dependency, WaitType waitType, WaitBehavior? waitBehavior)
DistributedApplicationBuilder.cs (2)
438o.DefaultWaitBehavior = options.DisableDashboard ? WaitBehavior.StopOnResourceUnavailable : WaitBehavior.WaitOnResourceUnavailable;
ResourceBuilderExtensions.cs (12)
2500WaitBehavior? waitBehavior = null) where T : IResourceWithWaitSupport 2522/// resources, calling <see cref="WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource}, WaitBehavior)"/> also results 2528/// wait operation. When <see cref="WaitBehavior.WaitOnResourceUnavailable"/> is specified, the wait 2531/// <para>When <see cref="WaitBehavior.StopOnResourceUnavailable"/> is specified, the wait operation 2545public static IResourceBuilder<T> WaitFor<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency, WaitBehavior waitBehavior) where T : IResourceWithWaitSupport 2553private static IResourceBuilder<T> WaitForCore<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency, WaitBehavior? waitBehavior, bool addRelationship) where T : IResourceWithWaitSupport 2625WaitBehavior? waitBehavior = null) where T : IResourceWithWaitSupport 2647/// <para>Unlike <see cref="WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource}, WaitBehavior)"/>, this method 2651/// wait operation. When <see cref="WaitBehavior.WaitOnResourceUnavailable"/> is specified, the wait 2654/// <para>When <see cref="WaitBehavior.StopOnResourceUnavailable"/> is specified, the wait operation 2668public static IResourceBuilder<T> WaitForStart<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency, WaitBehavior waitBehavior) where T : IResourceWithWaitSupport 2676private static IResourceBuilder<T> WaitForStartCore<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency, WaitBehavior? waitBehavior, bool addRelationship) where T : IResourceWithWaitSupport
Aspire.Hosting.Testing (3)
DistributedApplicationHostingTestingExtensions.cs (1)
88WaitBehavior.StopOnResourceUnavailable,
DistributedApplicationTestingBuilder.cs (1)
403options => options.DefaultWaitBehavior = WaitBehavior.StopOnResourceUnavailable);
DistributedApplicationTestingBuilderOptions.cs (1)
53/// <see cref="WaitBehavior.StopOnResourceUnavailable"/> after AppHost configuration. To use a different default
Aspire.Hosting.Testing.Tests (1)
DashboardTestingBuilderTests.cs (1)
106WaitBehavior.StopOnResourceUnavailable,
Aspire.Hosting.Tests (20)
ResourceNotificationTests.cs (7)
1421[InlineData(WaitBehavior.StopOnResourceUnavailable)] 1422[InlineData(WaitBehavior.WaitOnResourceUnavailable)] 1423public async Task WaitForResourceHealthyAsyncAlreadyReadyDoesNotLog(WaitBehavior waitBehavior) 1627() => notificationService.WaitForResourceHealthyAsync(resource.Name, WaitBehavior.StopOnResourceUnavailable, cts.Token)); 1662() => notificationService.WaitForResourceHealthyAsync(resource.Name, WaitBehavior.StopOnResourceUnavailable)); 1677() => notificationService.WaitForResourceHealthyAsync("does-not-exist", WaitBehavior.StopOnResourceUnavailable)); 1692var waitTask = notificationService.WaitForResourceHealthyAsync("does-not-exist", WaitBehavior.WaitOnResourceUnavailable, cts.Token);
WaitForTests.cs (13)
208.WaitFor(dependency, WaitBehavior.StopOnResourceUnavailable); 238dependency.WaitFor(failToStart, WaitBehavior.StopOnResourceUnavailable); 246WaitBehavior.StopOnResourceUnavailable 262dependency.WaitFor(failToStart, WaitBehavior.StopOnResourceUnavailable); 270WaitBehavior.WaitOnResourceUnavailable 279[InlineData(WaitBehavior.WaitOnResourceUnavailable, typeof(TimeoutException), "The operation has timed out.")] 280[InlineData(WaitBehavior.StopOnResourceUnavailable, typeof(DistributedApplicationException), "Stopped waiting for resource 'redis' to become healthy because it failed to start.")] 281public async Task WhenWaitBehaviorIsMissingWaitForResourceHealthyAsyncShouldUseDefaultWaitBehavior(WaitBehavior defaultWaitBehavior, Type exceptionType, string exceptionMessage) 293dependency.WaitFor(failToStart, WaitBehavior.StopOnResourceUnavailable); 353.WaitFor(dependency, WaitBehavior.WaitOnResourceUnavailable); 394o.DefaultWaitBehavior = WaitBehavior.WaitOnResourceUnavailable; 823.WaitForStart(dependency, WaitBehavior.StopOnResourceUnavailable); 830Assert.Equal(WaitBehavior.StopOnResourceUnavailable, waitAnnotation.WaitBehavior);