Skip to content

Commit

Permalink
Updates for Durable SQL v0.7.0-alpha changes (#197)
Browse files Browse the repository at this point in the history
  • Loading branch information
cgillum authored Apr 19, 2021
1 parent f14b10b commit 3950b21
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Common/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public static TimeSpan MaxAllowedExecutionTime
public const string DurableTaskStorageConnectionName = "azureStorageConnectionStringName";
public const string DurableTaskSqlConnectionName = "connectionStringName";
public const string DurableTaskStorageProvider = "storageProvider";
public const string DurableTaskMicrosoftSqlProviderType = "MicrosoftSQL";
public const string DurableTaskMicrosoftSqlProviderType = "mssql";
public const string MicrosoftSqlScaler = "mssql";
public const string DurableTask = "durableTask";
public const string Extensions = "extensions";
Expand Down
6 changes: 4 additions & 2 deletions Kudu.Core/Functions/KedaFunctionTriggerProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ internal static bool TryGetDurableKedaTrigger(string hostJsonText, out ScaleTrig
string storageType = storageProviderConfig?["type"]?.ToString();

// Custom storage types are supported starting in Durable Functions v2.4.2
// Minimum required version of Microsoft.DurableTask.SqlServer.AzureFunctions is v0.7.0-alpha
if (string.Equals(storageType, Constants.DurableTaskMicrosoftSqlProviderType, StringComparison.OrdinalIgnoreCase))
{
scaleTrigger = new ScaleTrigger
Expand All @@ -208,8 +209,9 @@ internal static bool TryGetDurableKedaTrigger(string hostJsonText, out ScaleTrig
Type = Constants.MicrosoftSqlScaler,
Metadata = new Dictionary<string, string>
{
["query"] = "SELECT dt.GetScaleMetric()",
["targetValue"] = "1", // super-conservative default
// Durable SQL scaling: https://microsoft.github.io/durabletask-mssql/#/scaling?id=worker-auto-scale
["query"] = "SELECT dt.GetScaleRecommendation(10, 1)", // max 10 orchestrations and 1 activity per replica
["targetValue"] = "1",
["connectionStringFromEnv"] = storageProviderConfig?[Constants.DurableTaskSqlConnectionName]?.ToString(),
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public void DurableFunctionApp()
using (var fileStream = File.OpenWrite(zipFilePath))
using (var archive = new ZipArchive(fileStream, ZipArchiveMode.Create, leaveOpen: true))
{
CreateJsonFileEntry(archive, "host.json", @"{""version"":""2.0"",""extensions"":{""durableTask"":{""hubName"":""DFTest"",""storageProvider"":{""type"":""MicrosoftSQL"",""connectionStringName"":""SQLDB_Connection""}}}}");
CreateJsonFileEntry(archive, "host.json", @"{""version"":""2.0"",""extensions"":{""durableTask"":{""hubName"":""DFTest"",""storageProvider"":{""type"":""mssql"",""connectionStringName"":""SQLDB_Connection""}}}}");
CreateJsonFileEntry(archive, "f1/function.json", @"{""bindings"":[{""type"":""orchestrationTrigger"",""name"":""context""}],""disabled"":false}");
CreateJsonFileEntry(archive, "f2/function.json", @"{""bindings"":[{""type"":""entityTrigger"",""name"":""ctx""}],""disabled"":false}");
CreateJsonFileEntry(archive, "f3/function.json", @"{""bindings"":[{""type"":""activityTrigger"",""name"":""input""}],""disabled"":false}");
Expand Down

0 comments on commit 3950b21

Please sign in to comment.