Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/WebJobs.Script.WebHost/Controllers/HostController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ public async Task<IActionResult> GetScaleStatus([FromBody] ScaleStatusContext co

// TEMP: Once https://github.com/Azure/azure-functions-host/issues/5161 is fixed, we should take
// FunctionsScaleManager as a parameter.
if (Utility.TryGetHostService(scriptHostManager, out FunctionsScaleManager scaleManager))
if (Utility.TryGetHostService(scriptHostManager, out ScaleManager scaleManager))
{
var scaleStatus = await scaleManager.GetScaleStatusAsync(context);
return new ObjectResult(scaleStatus);
Expand Down
2 changes: 1 addition & 1 deletion src/WebJobs.Script.WebHost/WebJobs.Script.WebHost.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
<PackageReference Include="Microsoft.Azure.Cosmos.Table" Version="1.0.8" />
<PackageReference Include="Microsoft.Azure.Storage.File" Version="11.1.7" />

<PackageReference Include="Microsoft.Azure.WebJobs" Version="3.0.36" />
<PackageReference Include="Microsoft.Azure.WebJobs" Version="3.0.36-11991" />
<PackageReference Include="Microsoft.Azure.WebJobs.Host.Storage" Version="5.0.0-beta.2-11957" />
<PackageReference Include="Microsoft.Azure.WebSites.DataProtection" Version="2.1.91-alpha" />
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="$(IdentityDependencyVersion)" />
Expand Down
94 changes: 0 additions & 94 deletions src/WebJobs.Script/Config/ScaleOptions.cs

This file was deleted.

34 changes: 34 additions & 0 deletions src/WebJobs.Script/Config/ScaleOptionsSetup.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using System;
using Microsoft.Azure.WebJobs.Host.Scale;
using Microsoft.Extensions.Options;

namespace Microsoft.Azure.WebJobs.Script.Config
{
public class ScaleOptionsSetup : IConfigureOptions<ScaleOptions>
{
private readonly IOptions<FunctionsHostingConfigOptions> _functionsHostingConfigOptions;
private readonly IEnvironment _environment;

public ScaleOptionsSetup(IEnvironment environment, IOptions<FunctionsHostingConfigOptions> functionsHostingConfigOptions)
{
_environment = environment;
_functionsHostingConfigOptions = functionsHostingConfigOptions;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to throw if null?

_environment = environment ?? throw new ArgumentNullException(nameof(environment));
_functionsHostingConfigOptions = functionsHostingConfigOptions ?? ?? throw new ArgumentNullException(nameof(functionsHostingConfigOptions));

}

public void Configure(ScaleOptions options)
{
options.IsTargetBasedScalingEnabled = _environment.IsTargetBasedScalingEnabled();
options.IsTargetBasedScalingEnabledForTriggerFunc = IsTargetBasedScalingEnabledForTrigger;
}

private bool IsTargetBasedScalingEnabledForTrigger(ITargetScaler targetScaler)
{
string assemblyName = targetScaler.GetType().Assembly.GetName().Name;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
string assemblyName = targetScaler.GetType().Assembly.GetName().Name;
string assemblyName = targetScaler?.GetType().Assembly.GetName().Name;

string flag = _functionsHostingConfigOptions.Value.GetFeature(assemblyName);
return flag == "1";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make "1" a constant with a name that describes what the 1 represents

}
}
}
Loading