58 references to WaitBehavior
Aspire.Hosting (39)
ApplicationModel\ResourceNotificationService.cs (20)
37
internal
WaitBehavior
DefaultWaitBehavior { get; set; }
58
DefaultWaitBehavior =
WaitBehavior
.StopOnResourceUnavailable;
77
DefaultWaitBehavior = serviceProvider.GetService<IOptions<ResourceNotificationServiceOptions>>()?.Value.DefaultWaitBehavior ??
WaitBehavior
.StopOnResourceUnavailable;
142
private 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
237
public async Task<ResourceEvent> WaitForResourceHealthyAsync(string resourceName,
WaitBehavior
waitBehavior, CancellationToken cancellationToken = default)
241
if (waitBehavior ==
WaitBehavior
.StopOnResourceUnavailable && !TryGetCurrentState(resourceName, out _))
286
internal static bool ShouldYieldHealthyWait(
WaitBehavior
waitBehavior, CustomResourceSnapshot snapshot) =>
289
WaitBehavior
.WaitOnResourceUnavailable => snapshot.HealthStatus == HealthStatus.Healthy,
290
WaitBehavior
.StopOnResourceUnavailable => snapshot.HealthStatus == HealthStatus.Healthy ||
372
private async Task WaitUntilStateAsync(IResource resource, IResource dependency,
WaitBehavior
waitBehavior,
399
if (waitBehavior ==
WaitBehavior
.StopOnResourceUnavailable)
434
static bool IsContinuableState(
WaitBehavior
waitBehavior, CustomResourceSnapshot snapshot) =>
437
WaitBehavior
.WaitOnResourceUnavailable => snapshot.State?.Text == KnownResourceStates.Running,
438
WaitBehavior
.StopOnResourceUnavailable => snapshot.State?.Text == KnownResourceStates.Running ||
448
private async Task WaitUntilStartedAsync(IResource resource, IResource dependency,
WaitBehavior
waitBehavior, CancellationToken cancellationToken, Func<string, Task>? onDependencyReady = null)
1468
public
WaitBehavior
DefaultWaitBehavior { get; set; }
ApplicationModel\WaitAnnotation.cs (1)
33
public
WaitBehavior
? WaitBehavior { get; init; }
Backchannel\AuxiliaryBackchannelRpcTarget.cs (1)
681
re => ResourceNotificationService.ShouldYieldHealthyWait(
WaitBehavior
.StopOnResourceUnavailable, re.Snapshot),
Backchannel\DashboardUrlsHelper.cs (1)
58
WaitBehavior
.StopOnResourceUnavailable,
Diagnostics\ProfilingTelemetry.cs (2)
483
public static ActivityScope StartResourceWaitForDependency(IConfiguration? configuration, IResource resource, IResource dependency, WaitType waitType,
WaitBehavior
? waitBehavior)
993
public void SetDependencyWait(IResource resource, IResource dependency, WaitType waitType,
WaitBehavior
? waitBehavior)
DistributedApplicationBuilder.cs (2)
423
o.DefaultWaitBehavior = options.DisableDashboard ?
WaitBehavior
.StopOnResourceUnavailable :
WaitBehavior
.WaitOnResourceUnavailable;
ResourceBuilderExtensions.cs (12)
2379
WaitBehavior
? 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
2424
public static IResourceBuilder<T> WaitFor<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency,
WaitBehavior
waitBehavior) where T : IResourceWithWaitSupport
2432
private static IResourceBuilder<T> WaitForCore<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency,
WaitBehavior
? waitBehavior, bool addRelationship) where T : IResourceWithWaitSupport
2504
WaitBehavior
? 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
2547
public static IResourceBuilder<T> WaitForStart<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency,
WaitBehavior
waitBehavior) where T : IResourceWithWaitSupport
2555
private 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)
88
WaitBehavior
.StopOnResourceUnavailable,
DistributedApplicationTestingBuilder.cs (1)
403
options => 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)
106
WaitBehavior
.StopOnResourceUnavailable,
Aspire.Hosting.Tests (15)
ResourceNotificationTests.cs (2)
1386
() => notificationService.WaitForResourceHealthyAsync("does-not-exist",
WaitBehavior
.StopOnResourceUnavailable));
1401
var waitTask = notificationService.WaitForResourceHealthyAsync("does-not-exist",
WaitBehavior
.WaitOnResourceUnavailable, cts.Token);
WaitForTests.cs (13)
208
.WaitFor(dependency,
WaitBehavior
.StopOnResourceUnavailable);
238
dependency.WaitFor(failToStart,
WaitBehavior
.StopOnResourceUnavailable);
246
WaitBehavior
.StopOnResourceUnavailable
262
dependency.WaitFor(failToStart,
WaitBehavior
.StopOnResourceUnavailable);
270
WaitBehavior
.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.")]
281
public async Task WhenWaitBehaviorIsMissingWaitForResourceHealthyAsyncShouldUseDefaultWaitBehavior(
WaitBehavior
defaultWaitBehavior, Type exceptionType, string exceptionMessage)
293
dependency.WaitFor(failToStart,
WaitBehavior
.StopOnResourceUnavailable);
353
.WaitFor(dependency,
WaitBehavior
.WaitOnResourceUnavailable);
394
o.DefaultWaitBehavior =
WaitBehavior
.WaitOnResourceUnavailable;
823
.WaitForStart(dependency,
WaitBehavior
.StopOnResourceUnavailable);
830
Assert.Equal(
WaitBehavior
.StopOnResourceUnavailable, waitAnnotation.WaitBehavior);