Skip to content

Commit 3ed9ce8

Browse files
Jzaballos/4.1.3.hotfix (#8053)
* improve scoping of FunctionRpcService; remove call to CreateDefaultBuilder (#8050) * Update common.props * switching ref * adding using statement * removing unsupported test from hotfix Co-authored-by: Brett Samblanet <[email protected]>
1 parent a17f811 commit 3ed9ce8

File tree

4 files changed

+23
-20
lines changed

4 files changed

+23
-20
lines changed

build/common.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<LangVersion>latest</LangVersion>
66
<MajorVersion>4</MajorVersion>
77
<MinorVersion>1</MinorVersion>
8-
<PatchVersion>2</PatchVersion>
8+
<PatchVersion>3</PatchVersion>
99
<BuildNumber Condition="'$(BuildNumber)' == '' ">0</BuildNumber>
1010
<PreviewVersion></PreviewVersion>
1111

src/WebJobs.Script.Grpc/Server/AspNetCoreGrpcHostBuilder.cs

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using Microsoft.AspNetCore.Hosting;
66
using Microsoft.AspNetCore.Server.Kestrel.Core;
77
using Microsoft.Azure.WebJobs.Script.Eventing;
8+
using Microsoft.Azure.WebJobs.Script.Grpc.Messages;
89
using Microsoft.Azure.WebJobs.Script.Workers;
910
using Microsoft.Extensions.DependencyInjection;
1011
using Microsoft.Extensions.Hosting;
@@ -13,24 +14,24 @@ namespace Microsoft.Azure.WebJobs.Script.Grpc
1314
{
1415
internal static class AspNetCoreGrpcHostBuilder
1516
{
16-
public static IHostBuilder CreateHostBuilder(IScriptEventManager scriptEventManager, int port) =>
17-
Microsoft.Extensions.Hosting.Host.CreateDefaultBuilder()
18-
.ConfigureWebHost(webBuilder =>
17+
public static IHostBuilder CreateHostBuilder(FunctionRpc.FunctionRpcBase service, IScriptEventManager scriptEventManager, int port) =>
18+
new HostBuilder().ConfigureWebHost(webBuilder =>
19+
{
20+
webBuilder.UseKestrel(options =>
1921
{
20-
webBuilder.UseKestrel(options =>
21-
{
22-
options.Listen(IPAddress.Parse(WorkerConstants.HostName), port, listenOptions =>
23-
{
24-
listenOptions.Protocols = HttpProtocols.Http2;
25-
});
26-
});
22+
options.Listen(IPAddress.Parse(WorkerConstants.HostName), port, listenOptions =>
23+
{
24+
listenOptions.Protocols = HttpProtocols.Http2;
25+
});
26+
});
2727

28-
webBuilder.ConfigureServices(services =>
29-
{
30-
services.AddSingleton(scriptEventManager);
31-
});
28+
webBuilder.ConfigureServices(services =>
29+
{
30+
services.AddSingleton(scriptEventManager);
31+
services.AddSingleton(service);
32+
});
3233

33-
webBuilder.UseStartup<Startup>();
34-
});
34+
webBuilder.UseStartup<Startup>();
35+
});
3536
}
3637
}

src/WebJobs.Script.Grpc/Server/AspNetCoreGrpcServer.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using Microsoft.AspNetCore.Hosting.Server;
88
using Microsoft.AspNetCore.Hosting.Server.Features;
99
using Microsoft.Azure.WebJobs.Script.Eventing;
10+
using Microsoft.Azure.WebJobs.Script.Grpc.Messages;
1011
using Microsoft.Azure.WebJobs.Script.Workers;
1112
using Microsoft.Azure.WebJobs.Script.Workers.Rpc;
1213
using Microsoft.Extensions.DependencyInjection;
@@ -22,10 +23,10 @@ public class AspNetCoreGrpcServer : IRpcServer, IDisposable, IAsyncDisposable
2223
private bool _disposed = false;
2324
private IHost _grpcHost;
2425

25-
public AspNetCoreGrpcServer(IScriptEventManager scriptEventManager, ILogger<AspNetCoreGrpcServer> logger)
26+
public AspNetCoreGrpcServer(FunctionRpc.FunctionRpcBase service, IScriptEventManager scriptEventManager, ILogger<AspNetCoreGrpcServer> logger)
2627
{
2728
int port = WorkerUtilities.GetUnusedTcpPort();
28-
_grpcHostBuilder = AspNetCoreGrpcHostBuilder.CreateHostBuilder(scriptEventManager, port);
29+
_grpcHostBuilder = AspNetCoreGrpcHostBuilder.CreateHostBuilder(service, scriptEventManager, port);
2930
_logger = logger;
3031
Uri = new Uri($"http://{WorkerConstants.HostName}:{port}");
3132
}

src/WebJobs.Script.Grpc/Server/Startup.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using Microsoft.AspNetCore.Builder;
55
using Microsoft.AspNetCore.Hosting;
6+
using Microsoft.Azure.WebJobs.Script.Grpc.Messages;
67
using Microsoft.Extensions.DependencyInjection;
78
using Microsoft.Extensions.Hosting;
89

@@ -32,7 +33,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
3233

3334
app.UseEndpoints(endpoints =>
3435
{
35-
endpoints.MapGrpcService<FunctionRpcService>();
36+
endpoints.MapGrpcService<FunctionRpc.FunctionRpcBase>();
3637
});
3738
}
3839
}

0 commit comments

Comments
 (0)