Created
March 16, 2022 09:50
-
-
Save neuecc/76c0ef8dba112b3b9919f4d601c6d707 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class GrpcTest : Workload | |
| { | |
| GrpcChannel? channel; | |
| Greeter.GreeterClient? client; | |
| public override async Task SetupAsync(WorkloadContext context) | |
| { | |
| channel = GrpcChannel.ForAddress("http://localhost:5027"); | |
| client = new Greeter.GreeterClient(channel); | |
| } | |
| public override async Task ExecuteAsync(WorkloadContext context) | |
| { | |
| await client!.SayHelloAsync(new HelloRequest(), cancellationToken: context.CancellationToken); | |
| } | |
| public override async Task TeardownAsync(WorkloadContext context) | |
| { | |
| if (channel != null) | |
| { | |
| await channel.ShutdownAsync(); | |
| channel.Dispose(); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment