Skip to content

Commit

Permalink
improve kernel event filter
Browse files Browse the repository at this point in the history
  • Loading branch information
colombod committed Jun 13, 2023
1 parent bd4cbf9 commit 72b66cb
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/Microsoft.DotNet.Interactive/KernelExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,20 +176,22 @@ private static async Task HandleSetMagicCommand<T>(
var sourceKernel = Kernel.Root.FindKernelByName(valueOptionResult.Kernel);

ValueProduced valueProduced;
if (
sourceKernel?.KernelInfo.IsProxy == false
&& valueOptionResult is { Name: var sourceValueName, Kernel: var sourceKernelName }
if (valueOptionResult is { Name: var sourceValueName, Kernel: var sourceKernelName }
&& sourceKernelName != "input")
{
valueProduced = events.SingleOrDefault(e =>
e.Name == sourceValueName && e.Command.TargetKernelName == sourceKernelName);
}else if (sourceKernel?.KernelInfo.IsProxy == true
&& valueOptionResult is { Name: var sourceValueName1 })
{
var destinationUri = sourceKernel?.KernelInfo.RemoteUri;

valueProduced = events.SingleOrDefault(e =>
e.Name == sourceValueName1 && e.Command.DestinationUri == destinationUri);
if (sourceKernel?.KernelInfo.IsProxy == true)
{
var destinationUri = sourceKernel?.KernelInfo.RemoteUri;

valueProduced = events.SingleOrDefault(e =>
e.Name == sourceValueName && e.Command.DestinationUri == destinationUri);
}
else
{

valueProduced = events.SingleOrDefault(e =>
e.Name == sourceValueName && e.Command.TargetKernelName == sourceKernelName);
}
}
else
{
Expand Down

0 comments on commit 72b66cb

Please sign in to comment.