Skip to content

Commit

Permalink
Remove duplicate binding data upon detecting capability
Browse files Browse the repository at this point in the history
  • Loading branch information
yojagad committed Sep 5, 2019
1 parent 6bc641f commit f6aeef8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/WebJobs.Script/Rpc/LanguageWorkerChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reactive.Concurrency;
using System.Reactive.Linq;
using System.Threading.Tasks;
using System.Threading.Tasks.Dataflow;
using Microsoft.AspNetCore.Http.Internal;
using Microsoft.Azure.WebJobs.Script.Description;
using Microsoft.Azure.WebJobs.Script.Diagnostics;
using Microsoft.Azure.WebJobs.Script.Eventing;
Expand Down Expand Up @@ -311,6 +311,10 @@ internal void SendInvocationRequest(ScriptInvocationContext context)
{
if (pair.Value != null)
{
if ((pair.Value is DefaultHttpRequest) && IsTriggerMetadataPopulatedByWorker())
{
continue;
}
invocationRequest.TriggerMetadata.Add(pair.Key, pair.Value.ToRpc(_workerChannelLogger, _workerCapabilities));
}
}
Expand Down Expand Up @@ -429,5 +433,10 @@ public void Dispose()
_disposing = true;
Dispose(true);
}

private bool IsTriggerMetadataPopulatedByWorker()
{
return !string.IsNullOrEmpty(_workerCapabilities.GetCapabilityState(LanguageWorkerConstants.RpcHttpTriggerMetadataRemoved));
}
}
}
1 change: 1 addition & 0 deletions src/WebJobs.Script/Rpc/LanguageWorkerConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public static class LanguageWorkerConstants
public const string RawHttpBodyBytes = "RawHttpBodyBytes";
public const string TypedDataCollection = "TypedDataCollection";
public const string RpcHttpBodyOnly = "RpcHttpBodyOnly";
public const string RpcHttpTriggerMetadataRemoved = "RpcHttpTriggerMetadataRemoved";

// Thresholds
public const int WorkerRestartErrorIntervalThresholdInMinutes = 30;
Expand Down

0 comments on commit f6aeef8

Please sign in to comment.