Skip to content

Commit e53a5de

Browse files
authored
Set the MetadataProvider timeout to InfiniteTimeSpan for LA (#10589)
* Use InfiniteTimeSpan for LA * Update notes * Update release_notes.md
1 parent 9620a11 commit e53a5de

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

release_notes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
- My change description (#PR)
55
-->
66
- The base commit for the release branch is set to v4.636.0.
7+
- Set the MetadataProvider timeout to InfiniteTimeSpan for LogicApps

src/WebJobs.Script/Host/FunctionMetadataManager.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.Collections.Generic;
77
using System.Collections.Immutable;
88
using System.Linq;
9+
using System.Threading;
910
using System.Threading.Tasks;
1011
using Microsoft.Azure.WebJobs.Logging;
1112
using Microsoft.Azure.WebJobs.Script.Description;
@@ -34,6 +35,7 @@ public class FunctionMetadataManager : IFunctionMetadataManager
3435
private ImmutableArray<FunctionMetadata> _functionMetadataArray;
3536
private Dictionary<string, ICollection<string>> _functionErrors = new Dictionary<string, ICollection<string>>();
3637
private ConcurrentDictionary<string, FunctionMetadata> _functionMetadataMap = new ConcurrentDictionary<string, FunctionMetadata>(StringComparer.OrdinalIgnoreCase);
38+
private TimeSpan _metadataProviderTimeout;
3739

3840
public FunctionMetadataManager(IOptions<ScriptJobHostOptions> scriptOptions, IFunctionMetadataProvider functionMetadataProvider,
3941
IOptions<HttpWorkerOptions> httpWorkerOptions, IScriptHostManager scriptHostManager, ILoggerFactory loggerFactory,
@@ -46,6 +48,8 @@ public FunctionMetadataManager(IOptions<ScriptJobHostOptions> scriptOptions, IFu
4648
_isHttpWorker = httpWorkerOptions?.Value?.Description != null;
4749
_environment = environment;
4850

51+
_metadataProviderTimeout = _environment.IsLogicApp() ? Timeout.InfiniteTimeSpan : TimeSpan.FromSeconds(DefaultMetadataProviderTimeoutInSeconds);
52+
4953
// Every time script host is re-initializing, we also need to re-initialize
5054
// services that change with the scope of the script host.
5155
scriptHostManager.ActiveHostChanged += (s, e) =>
@@ -225,7 +229,7 @@ private void AddMetadataFromCustomProviders(IEnumerable<IFunctionProvider> funct
225229
foreach (var functionProvider in functionProviders)
226230
{
227231
var getFunctionMetadataFromProviderTask = functionProvider.GetFunctionMetadataAsync();
228-
var delayTask = Task.Delay(TimeSpan.FromSeconds(MetadataProviderTimeoutInSeconds));
232+
var delayTask = Task.Delay(_metadataProviderTimeout);
229233

230234
var completedTask = Task.WhenAny(getFunctionMetadataFromProviderTask, delayTask).ContinueWith(t =>
231235
{
@@ -235,7 +239,7 @@ private void AddMetadataFromCustomProviders(IEnumerable<IFunctionProvider> funct
235239
}
236240

237241
// Timeout case.
238-
throw new TimeoutException($"Timeout occurred while retrieving metadata from provider '{functionProvider.GetType().FullName}'. The operation exceeded the configured timeout of {MetadataProviderTimeoutInSeconds} seconds.");
242+
throw new TimeoutException($"Timeout occurred while retrieving metadata from provider '{functionProvider.GetType().FullName}'. The operation exceeded the configured timeout of {_metadataProviderTimeout.TotalSeconds} seconds.");
239243
});
240244

241245
functionProviderTasks.Add(completedTask);

0 commit comments

Comments
 (0)