Skip to content

Commit 4bbc480

Browse files
authored
Added PartitionCount lookup from host.json (#3027)
Co-authored-by: gorillapower <[email protected]>
1 parent 9b2125f commit 4bbc480

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/Azure.Functions.Cli/Common/DurableManager.cs

+13
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ internal class DurableManager : IDurableManager
3030

3131
private string _connectionStringKey;
3232

33+
private int? _partitionCount;
34+
3335
public const string DefaultConnectionStringKey = "AzureWebJobsStorage";
3436

3537
public const string DefaultTaskHubName = "DurableFunctionsHub";
@@ -80,6 +82,12 @@ private void SetConnectionStringAndTaskHubName()
8082
?? _connectionStringKey;
8183
_taskHubName = durableTask.GetValue("HubName", StringComparison.OrdinalIgnoreCase)?.ToString()
8284
?? _taskHubName;
85+
86+
if (durableTask.TryGetValue("storageProvider", StringComparison.OrdinalIgnoreCase, out JToken storageProviderToken))
87+
{
88+
JObject storageProviderObject = storageProviderToken as JObject;
89+
_partitionCount = storageProviderObject?.GetValue("partitionCount", StringComparison.OrdinalIgnoreCase)?.Value<int?>();
90+
}
8391
}
8492
}
8593
else
@@ -110,6 +118,11 @@ private void SetStorageServiceAndTaskHubClient(out AzureStorageOrchestrationServ
110118
StorageConnectionString = connectionString,
111119
};
112120

121+
if (_partitionCount.HasValue)
122+
{
123+
settings.PartitionCount = _partitionCount.Value;
124+
}
125+
113126
orchestrationService = new AzureStorageOrchestrationService(settings);
114127
taskHubClient = new TaskHubClient(orchestrationService);
115128
}

0 commit comments

Comments
 (0)