Skip to content

Commit 296b1e6

Browse files
authored
Single instance of worker configs (#3338)
* Fixing the worker config comparison so that it doesn't check against new instances * update api signature * update signature for languageworkeroptions * update test
1 parent d59878b commit 296b1e6

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

src/WebJobs.Script/Rpc/Configuration/LanguageWorkerOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ namespace Microsoft.Azure.WebJobs.Script.Rpc
77
{
88
public class LanguageWorkerOptions
99
{
10-
public IEnumerable<WorkerConfig> WorkerConfigs { get; set; }
10+
public IList<WorkerConfig> WorkerConfigs { get; set; }
1111
}
1212
}

src/WebJobs.Script/Rpc/Configuration/WorkerConfigFactory.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@ public WorkerConfigFactory(IConfiguration config, ILogger logger)
3838

3939
public string WorkersDirPath { get; }
4040

41-
public IEnumerable<WorkerConfig> GetConfigs()
41+
public IList<WorkerConfig> GetConfigs()
4242
{
4343
BuildWorkerProviderDictionary();
44+
var result = new List<WorkerConfig>();
45+
4446
foreach (var provider in WorkerProviders)
4547
{
4648
var description = provider.GetDescription();
@@ -59,17 +61,20 @@ public IEnumerable<WorkerConfig> GetConfigs()
5961

6062
if (provider.TryConfigureArguments(arguments, _logger))
6163
{
62-
yield return new WorkerConfig()
64+
var config = new WorkerConfig()
6365
{
6466
Description = description,
6567
Arguments = arguments
6668
};
69+
result.Add(config);
6770
}
6871
else
6972
{
7073
_logger.LogError($"Could not configure language worker {description.Language}.");
7174
}
7275
}
76+
77+
return result;
7378
}
7479

7580
internal void BuildWorkerProviderDictionary()

test/WebJobs.Script.Tests.Shared/TestHelpers.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ public static async Task<string> ReadStreamToEnd(Stream stream)
239239
}
240240
}
241241

242-
public static IEnumerable<WorkerConfig> GetTestWorkerConfigs()
242+
public static IList<WorkerConfig> GetTestWorkerConfigs()
243243
{
244244
var nodeWorkerDesc = GetTestWorkerDescription("node", ".js");
245245
var javaWorkerDesc = GetTestWorkerDescription("java", ".jar");

0 commit comments

Comments
 (0)