Skip to content

Commit 84bd9f7

Browse files
authored
WaitFor PR feedback (#5500)
Follow up feedback for #5394.
1 parent c973ace commit 84bd9f7

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

src/Aspire.Hosting/ApplicationModel/CustomResourceSnapshot.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,5 +158,5 @@ public static class KnownResourceStates
158158
/// <summary>
159159
/// List of terminal states.
160160
/// </summary>
161-
public static readonly string[] TerminalStates = [Finished, FailedToStart, Exited];
161+
public static readonly IReadOnlyList<string> TerminalStates = [Finished, FailedToStart, Exited];
162162
}

src/Aspire.Hosting/ApplicationModel/ResourceNotificationService.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,20 +104,19 @@ public async Task<string> WaitForResourceAsync(string resourceName, IEnumerable<
104104
}
105105

106106
/// <summary>
107-
/// Waits for a resource to reach one of the specified states. See <see cref="KnownResourceStates"/> for common states.
107+
/// Waits until a resource satisfies the specified predicate.
108108
/// </summary>
109109
/// <remarks>
110-
/// This method returns a task that will complete when the resource reaches one of the specified target states. If the resource
111-
/// is already in the target state, the method will return immediately.<br/>
112-
/// If the resource doesn't reach one of the target states before <paramref name="cancellationToken"/> is signaled, this method
110+
/// This method returns a task that will complete when the specified predicate returns <see langword="true" />.<br/>
111+
/// If the predicate isn't satisfied before <paramref name="cancellationToken"/> is signaled, this method
113112
/// will throw <see cref="OperationCanceledException"/>.
114113
/// </remarks>
115114
/// <param name="resourceName">The name of the resource.</param>
116115
/// <param name="predicate">A predicate which is evaluated for each <see cref="ResourceEvent"/> for the selected resource.</param>
117116
/// <param name="cancellationToken">A cancellation token that cancels the wait operation when signaled.</param>
118117
/// <returns>A <see cref="Task{ResourceEvent}"/> representing the wait operation and which of the target states the resource reached.</returns>
119118
[System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters",
120-
Justification = "targetState(s) parameters are mutually exclusive.")]
119+
Justification = "predicate and targetState(s) parameters are mutually exclusive.")]
121120
public async Task<ResourceEvent> WaitForResourceAsync(string resourceName, Func<ResourceEvent, bool> predicate, CancellationToken cancellationToken = default)
122121
{
123122
using var watchCts = CancellationTokenSource.CreateLinkedTokenSource(_applicationStopping, cancellationToken);

src/Aspire.Hosting/PublicAPI.Unshipped.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,5 +83,5 @@ static Aspire.Hosting.ContainerResourceBuilderExtensions.WithBuildArg<T>(this As
8383
static Aspire.Hosting.ContainerResourceBuilderExtensions.WithBuildSecret<T>(this Aspire.Hosting.ApplicationModel.IResourceBuilder<T!>! builder, string! name, Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ParameterResource!>! value) -> Aspire.Hosting.ApplicationModel.IResourceBuilder<T!>!
8484
static Aspire.Hosting.ProjectResourceBuilderExtensions.AddProject(this Aspire.Hosting.IDistributedApplicationBuilder! builder, string! name, string! projectPath, System.Action<Aspire.Hosting.ProjectResourceOptions!>! configure) -> Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ProjectResource!>!
8585
static Aspire.Hosting.ProjectResourceBuilderExtensions.AddProject<TProject>(this Aspire.Hosting.IDistributedApplicationBuilder! builder, string! name, System.Action<Aspire.Hosting.ProjectResourceOptions!>! configure) -> Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ProjectResource!>!
86-
static readonly Aspire.Hosting.ApplicationModel.KnownResourceStates.TerminalStates -> string![]!
86+
static readonly Aspire.Hosting.ApplicationModel.KnownResourceStates.TerminalStates -> System.Collections.Generic.IReadOnlyList<string!>!
8787
static readonly Aspire.Hosting.ApplicationModel.KnownResourceStates.Waiting -> string!

0 commit comments

Comments
 (0)