58 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; 142private async Task WaitUntilHealthyAsync(IResource resource, IResource dependency, WaitBehavior waitBehavior, CancellationToken cancellationToken, Func<string, Task>? onDependencyReady = null) 200/// control this behavior use <see cref="WaitForResourceHealthyAsync(string, WaitBehavior, CancellationToken)"/> 224/// <see cref="WaitBehavior"/> controls how the wait operation behaves when the resource 228/// When <see cref="WaitBehavior.WaitOnResourceUnavailable"/> is specified the wait operation 232/// When <see cref="WaitBehavior.StopOnResourceUnavailable"/> is specified the wait operation 237public async Task<ResourceEvent> WaitForResourceHealthyAsync(string resourceName, WaitBehavior waitBehavior, CancellationToken cancellationToken = default) 241if (waitBehavior == WaitBehavior.StopOnResourceUnavailable && !TryGetCurrentState(resourceName, out _)) 286internal static bool ShouldYieldHealthyWait(WaitBehavior waitBehavior, CustomResourceSnapshot snapshot) => 289WaitBehavior.WaitOnResourceUnavailable => snapshot.HealthStatus == HealthStatus.Healthy, 290WaitBehavior.StopOnResourceUnavailable => snapshot.HealthStatus == HealthStatus.Healthy || 372private async Task WaitUntilStateAsync(IResource resource, IResource dependency, WaitBehavior waitBehavior, 399if (waitBehavior == WaitBehavior.StopOnResourceUnavailable) 434static bool IsContinuableState(WaitBehavior waitBehavior, CustomResourceSnapshot snapshot) => 437WaitBehavior.WaitOnResourceUnavailable => snapshot.State?.Text == KnownResourceStates.Running, 438WaitBehavior.StopOnResourceUnavailable => snapshot.State?.Text == KnownResourceStates.Running || 448private async Task WaitUntilStartedAsync(IResource resource, IResource dependency, WaitBehavior waitBehavior, CancellationToken cancellationToken, Func<string, Task>? onDependencyReady = null) 1468public WaitBehavior DefaultWaitBehavior { get; set; }
ApplicationModel\WaitAnnotation.cs (1)
33public WaitBehavior? WaitBehavior { get; init; }
Backchannel\AuxiliaryBackchannelRpcTarget.cs (1)
681re => 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)
423o.DefaultWaitBehavior = options.DisableDashboard ? WaitBehavior.StopOnResourceUnavailable : WaitBehavior.WaitOnResourceUnavailable;
ResourceBuilderExtensions.cs (12)
2379WaitBehavior? waitBehavior = null) where T : IResourceWithWaitSupport 2401/// resources, calling <see cref="WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource}, WaitBehavior)"/> also results 2407/// wait operation. When <see cref="WaitBehavior.WaitOnResourceUnavailable"/> is specified, the wait 2410/// <para>When <see cref="WaitBehavior.StopOnResourceUnavailable"/> is specified, the wait operation 2424public static IResourceBuilder<T> WaitFor<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency, WaitBehavior waitBehavior) where T : IResourceWithWaitSupport 2432private static IResourceBuilder<T> WaitForCore<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency, WaitBehavior? waitBehavior, bool addRelationship) where T : IResourceWithWaitSupport 2504WaitBehavior? waitBehavior = null) where T : IResourceWithWaitSupport 2526/// <para>Unlike <see cref="WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource}, WaitBehavior)"/>, this method 2530/// wait operation. When <see cref="WaitBehavior.WaitOnResourceUnavailable"/> is specified, the wait 2533/// <para>When <see cref="WaitBehavior.StopOnResourceUnavailable"/> is specified, the wait operation 2547public static IResourceBuilder<T> WaitForStart<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency, WaitBehavior waitBehavior) where T : IResourceWithWaitSupport 2555private 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 (15)
ResourceNotificationTests.cs (2)
1386() => notificationService.WaitForResourceHealthyAsync("does-not-exist", WaitBehavior.StopOnResourceUnavailable)); 1401var 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);