Skip to content

Commit 0b7ff55

Browse files
committed
Enabling worker indexing for Logic apps behind an enviornment setting
1 parent ccb8fd8 commit 0b7ff55

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

src/WebJobs.Script/Environment/EnvironmentExtensions.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,15 @@ public static bool IsLogicApp(this IEnvironment environment)
425425
return !string.IsNullOrEmpty(appKind) && appKind.Contains(ScriptConstants.WorkFlowAppKind);
426426
}
427427

428+
/// <summary>
429+
/// Gets if codeful mode is enabled for Logic App app kind.
430+
/// </summary>
431+
public static bool IsLogicAppCodefulModeEnabled(this IEnvironment environment)
432+
{
433+
bool.TryParse(environment.GetEnvironmentVariable(LogicAppCodefulModeEnabled), out bool logicAppCodefulModeEnabled);
434+
return logicAppCodefulModeEnabled;
435+
}
436+
428437
/// <summary>
429438
/// Gets if runtime environment needs multi language.
430439
/// </summary>

src/WebJobs.Script/Environment/EnvironmentSettingNames.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ public static class EnvironmentSettingNames
150150

151151
public const string AppKind = "APP_KIND";
152152

153+
public const string LogicAppCodefulModeEnabled = "WORKFLOW_CODEFUL_ENABLED";
154+
153155
public const string DrainOnApplicationStopping = "FUNCTIONS_ENABLE_DRAIN_ON_APP_STOPPING";
154156
}
155157
}

src/WebJobs.Script/Host/ScriptHost.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ internal async Task<Collection<FunctionDescriptor>> GetFunctionDescriptorsAsync(
787787
Collection<FunctionDescriptor> functionDescriptors = new Collection<FunctionDescriptor>();
788788
if (!cancellationToken.IsCancellationRequested)
789789
{
790-
bool throwOnWorkerRuntimeAndPayloadMetadataMismatch = true;
790+
bool throwOnWorkerRuntimeAndPayloadMetadataMismatch = _environment.IsLogicApp() && _environment.IsLogicAppCodefulModeEnabled() ? false : true;
791791
// this dotnet isolated specific logic is temporary to ensure in-proc payload compatibility with "dotnet-isolated" as the FUNCTIONS_WORKER_RUNTIME value.
792792
if (string.Equals(workerRuntime, RpcWorkerConstants.DotNetIsolatedLanguageWorkerName, StringComparison.OrdinalIgnoreCase))
793793
{

src/WebJobs.Script/Utility.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1028,7 +1028,8 @@ public static void ValidateRetryOptions(RetryOptions
10281028
// WORKER_INDEXING_DISABLED contains the customers app name worker indexing is then disabled for that customer only
10291029
public static bool CanWorkerIndex(IEnumerable<RpcWorkerConfig> workerConfigs, IEnvironment environment, FunctionsHostingConfigOptions functionsHostingConfigOptions)
10301030
{
1031-
if (environment.IsLogicApp())
1031+
// NOTE(apseth): Enabling the worker indexing for Logic Apps with codeful mode enabled.
1032+
if (environment.IsLogicApp() && !environment.IsLogicAppCodefulModeEnabled())
10321033
{
10331034
return false;
10341035
}

0 commit comments

Comments
 (0)