-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added telemetry injection point for Ask<T>
#5297
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,6 +91,18 @@ public interface IActorRefProvider | |
/// <param name="path">A path returned by <see cref="TempPath"/>. Do NOT pass in any other path!</param> | ||
void UnregisterTempActor(ActorPath path); | ||
|
||
/// <summary> | ||
/// Automatically generates a <see cref="FutureActorRef{T}"/> with a temporary path. | ||
/// </summary> | ||
/// <remarks> | ||
/// Does not call <see cref="RegisterTempActor"/> or <see cref="UnregisterTempActor"/>. | ||
/// </remarks> | ||
/// <param name="tcs">A typed <see cref="TaskCompletionSource{T}"/></param> | ||
/// <typeparam name="T">The type of output this <see cref="FutureActorRef{T}"/> expects.</typeparam> | ||
/// <returns>A new, single-use <see cref="FutureActorRef{T}"/> instance.</returns> | ||
[InternalApi] | ||
FutureActorRef<T> CreateFutureRef<T>(TaskCompletionSource<T> tcs); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New |
||
|
||
/// <summary> | ||
/// Actor factory with create-only semantics: will create an actor as | ||
/// described by <paramref name="props"/> with the given <paramref name="supervisor"/> and <paramref name="path"/> (may be different | ||
|
@@ -386,6 +398,16 @@ public void UnregisterTempActor(ActorPath path) | |
_tempContainer.RemoveChild(path.Name); | ||
} | ||
|
||
/// <inheritdoc cref="IActorRefProvider.CreateFutureRef{T}"/> | ||
public FutureActorRef<T> CreateFutureRef<T>(TaskCompletionSource<T> tcs) | ||
{ | ||
//create a new tempcontainer path | ||
var path = TempPath(); | ||
|
||
var future = new FutureActorRef<T>(tcs, path, this); | ||
return future; | ||
} | ||
|
||
/// <summary> | ||
/// Initializes the ActorRefProvider | ||
/// </summary> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -148,10 +148,8 @@ public static Task<T> Ask<T>(this ICanTell self, Func<IActorRef, object> message | |
ctr2 = cancellationToken.Register(() => result.TrySetCanceled()); | ||
} | ||
|
||
//create a new tempcontainer path | ||
var path = provider.TempPath(); | ||
|
||
var future = new FutureActorRef<T>(result, path, provider); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moved these two lines to the factory method - all of the TCS setup is left as-is. |
||
var future = provider.CreateFutureRef(result); | ||
var path = future.Path; | ||
|
||
//The future actor needs to be unregistered in the temp container | ||
_ = result.Task.ContinueWith(t => | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated XML-DOC fix I made to resolve a compiler warning.