63 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;
147
private 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
242
public async Task<ResourceEvent> WaitForResourceHealthyAsync(string resourceName,
WaitBehavior
waitBehavior, CancellationToken cancellationToken = default)
244
if (waitBehavior ==
WaitBehavior
.StopOnResourceUnavailable && !TryGetCurrentState(resourceName, out _))
315
internal static bool ShouldYieldHealthyWait(
WaitBehavior
waitBehavior, CustomResourceSnapshot snapshot) =>
318
WaitBehavior
.WaitOnResourceUnavailable => snapshot.HealthStatus == HealthStatus.Healthy,
319
WaitBehavior
.StopOnResourceUnavailable => snapshot.HealthStatus == HealthStatus.Healthy ||
401
private async Task WaitUntilStateAsync(IResource resource, IResource dependency,
WaitBehavior
waitBehavior,
428
if (waitBehavior ==
WaitBehavior
.StopOnResourceUnavailable)
463
static bool IsContinuableState(
WaitBehavior
waitBehavior, CustomResourceSnapshot snapshot) =>
466
WaitBehavior
.WaitOnResourceUnavailable => snapshot.State?.Text == KnownResourceStates.Running,
467
WaitBehavior
.StopOnResourceUnavailable => snapshot.State?.Text == KnownResourceStates.Running ||
477
private async Task WaitUntilStartedAsync(IResource resource, IResource dependency,
WaitBehavior
waitBehavior, CancellationToken cancellationToken, Func<string, Task>? onDependencyReady = null)
1505
public
WaitBehavior
DefaultWaitBehavior { get; set; }
ApplicationModel\WaitAnnotation.cs (1)
33
public
WaitBehavior
? WaitBehavior { get; init; }
Backchannel\AuxiliaryBackchannelRpcTarget.cs (1)
703
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)
438
o.DefaultWaitBehavior = options.DisableDashboard ?
WaitBehavior
.StopOnResourceUnavailable :
WaitBehavior
.WaitOnResourceUnavailable;
ResourceBuilderExtensions.cs (12)
2500
WaitBehavior
? 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
2545
public static IResourceBuilder<T> WaitFor<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency,
WaitBehavior
waitBehavior) where T : IResourceWithWaitSupport
2553
private static IResourceBuilder<T> WaitForCore<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency,
WaitBehavior
? waitBehavior, bool addRelationship) where T : IResourceWithWaitSupport
2625
WaitBehavior
? 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
2668
public static IResourceBuilder<T> WaitForStart<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency,
WaitBehavior
waitBehavior) where T : IResourceWithWaitSupport
2676
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 (20)
ResourceNotificationTests.cs (7)
1421
[InlineData(
WaitBehavior
.StopOnResourceUnavailable)]
1422
[InlineData(
WaitBehavior
.WaitOnResourceUnavailable)]
1423
public 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));
1692
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);