Skip to content

Commit

Permalink
PR feedback + ensure MetadataProviderTimeout is configurable even for…
Browse files Browse the repository at this point in the history
… logic apps
  • Loading branch information
liliankasem committed Oct 16, 2024
1 parent 4c19983 commit 6dec500
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
5 changes: 3 additions & 2 deletions release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
- Improving console log handling during specialization (#10345)
- Update Node.js Worker Version to [3.10.1](https://github.com/Azure/azure-functions-nodejs-worker/releases/tag/v3.10.1)
- Remove packages `Microsoft.Azure.Cosmos.Table` and `Microsoft.Azure.DocumentDB.Core` (#10503)
- Implement host configuration property to all configuration of the metadata provider timeout (#10526)
- The value can be set via `metadataProviderTimeout` in host.json and defaults to "00:00:30" (30 seconds)
- Implement host configuration property to allow configuration of the metadata provider timeout period (#10526)
- The value can be set via `metadataProviderTimeout` in host.json and defaults to "00:00:30" (30 seconds).
- For logic apps, unless configured via the host.json, the timeout is disabled by default.
3 changes: 1 addition & 2 deletions src/WebJobs.Script/Config/ScriptJobHostOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@ public string RootScriptPath

/// <summary>
/// Gets or sets a value indicating the timeout duration for the function metadata provider.
/// Defaults to 30 seconds.
/// </summary>
public TimeSpan MetadataProviderTimeout { get; set; } = TimeSpan.FromSeconds(30);
public TimeSpan MetadataProviderTimeout { get; set; } = TimeSpan.Zero;
}
}
7 changes: 4 additions & 3 deletions src/WebJobs.Script/Config/ScriptJobHostOptionsSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ internal class ScriptJobHostOptionsSetup : IConfigureOptions<ScriptJobHostOption
internal static readonly TimeSpan DefaultConsumptionFunctionTimeout = TimeSpan.FromMinutes(5);
internal static readonly TimeSpan MaxFunctionTimeoutDynamic = TimeSpan.FromMinutes(10);
internal static readonly TimeSpan DefaultFunctionTimeout = TimeSpan.FromMinutes(30);
internal static readonly TimeSpan DefaultMetadataProviderTimeout = TimeSpan.FromSeconds(30);

public ScriptJobHostOptionsSetup(IConfiguration configuration, IEnvironment environment, IOptions<ScriptApplicationHostOptions> applicationHostOptions)
{
Expand Down Expand Up @@ -60,10 +61,10 @@ public void Configure(ScriptJobHostOptions options)
// FunctionTimeout
ConfigureFunctionTimeout(options);

if (_environment.IsLogicApp())
if (options.MetadataProviderTimeout == TimeSpan.Zero)
{
// Logic Apps requires no timeout
options.MetadataProviderTimeout = Timeout.InfiniteTimeSpan;
// If the timeout value is not configured and we are running in a logic app, we want to disable the timeout
options.MetadataProviderTimeout = _environment.IsLogicApp() ? Timeout.InfiniteTimeSpan : DefaultMetadataProviderTimeout;
}

// If we have a read only file system, override any configuration and
Expand Down
2 changes: 1 addition & 1 deletion src/WebJobs.Script/Host/FunctionMetadataManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace Microsoft.Azure.WebJobs.Script
{
public class FunctionMetadataManager : IFunctionMetadataManager
{
private const string FunctionConfigurationErrorMessage = "Unable to determine the primary function script. Make sure atleast one script file is present. Try renaming your entry point script to 'run' or alternatively you can specify the name of the entry point script explicitly by adding a 'scriptFile' property to your function metadata.";
private const string FunctionConfigurationErrorMessage = "Unable to determine the primary function script. Make sure at least one script file is present. Try renaming your entry point script to 'run' or alternatively you can specify the name of the entry point script explicitly by adding a 'scriptFile' property to your function metadata.";
private const string MetadataProviderName = "Custom";
private readonly IServiceProvider _serviceProvider;
private IFunctionMetadataProvider _functionMetadataProvider;
Expand Down
3 changes: 1 addition & 2 deletions test/WebJobs.Script.Tests/FunctionMetadataManagerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@
using Microsoft.WebJobs.Script.Tests;
using Moq;
using Xunit;
using static Microsoft.Azure.AppService.Proxy.Common.Constants.WellKnownHttpHeaders;

namespace Microsoft.Azure.WebJobs.Script.Tests
{
public class FunctionMetadataManagerTests
{
private const string _expectedErrorMessage = "Unable to determine the primary function script.Make sure atleast one script file is present.Try renaming your entry point script to 'run' or alternatively you can specify the name of the entry point script explicitly by adding a 'scriptFile' property to your function metadata.";
private const string _expectedErrorMessage = "Unable to determine the primary function script. Make sure at least one script file is present. Try renaming your entry point script to 'run' or alternatively you can specify the name of the entry point script explicitly by adding a 'scriptFile' property to your function metadata.";
private ScriptJobHostOptions _scriptJobHostOptions = new ScriptJobHostOptions();
private Mock<IFunctionMetadataProvider> _mockFunctionMetadataProvider;
private FunctionMetadataManager _testFunctionMetadataManager;
Expand Down

0 comments on commit 6dec500

Please sign in to comment.