Skip to content

Commit 2862d4d

Browse files
author
Sophia Tevosyan
committed
addressing copilot comments
1 parent 19823d8 commit 2862d4d

File tree

5 files changed

+6
-11
lines changed

5 files changed

+6
-11
lines changed

src/Worker/Grpc/GrpcEntityRunner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public static async Task<string> LoadAndRunAsync(
135135

136136
if (addToExtendedSessions)
137137
{
138-
extendedSessions.Set(
138+
extendedSessions!.Set(
139139
request.InstanceId,
140140
result.EntityState,
141141
new MemoryCacheEntryOptions { SlidingExpiration = TimeSpan.FromSeconds(extendedSessionIdleTimeoutInSeconds) });

src/Worker/Grpc/GrpcInstanceRunnerUtils.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4-
using System;
5-
using System.Collections.Generic;
6-
using System.Text;
74
using Microsoft.Extensions.Caching.Memory;
85

96
namespace Microsoft.DurableTask.Worker.Grpc;
@@ -19,7 +16,7 @@ static class GrpcInstanceRunnerUtils
1916
/// </summary>
2017
/// <remarks>
2118
/// If any request property is missing or invalid (i.e. the key is misspelled or the value is of the wrong type),
22-
/// extended sessions are not enabled and default values are assigned are assigned to the returns.
19+
/// extended sessions are not enabled and default values are assigned to the returns.
2320
/// </remarks>
2421
/// <param name="properties">
2522
/// A dictionary containing request properties used to configure extended session behavior.

src/Worker/Grpc/GrpcOrchestrationRunner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ public static string LoadAndRun(
207207

208208
if (addToExtendedSessions && !executor.IsCompleted)
209209
{
210-
extendedSessions.Set<ExtendedSessionState>(
210+
extendedSessions!.Set<ExtendedSessionState>(
211211
request.InstanceId,
212212
new(runtimeState, shim, executor),
213213
new MemoryCacheEntryOptions { SlidingExpiration = TimeSpan.FromSeconds(extendedSessionIdleTimeoutInSeconds) });

test/Worker/Grpc.Tests/GrpcEntityRunnerTests.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ public async Task MalformedRequestParameters_Means_CacheNotInitialized_Async()
7373
{ "ExtendedSessionsIdleTimeoutInSeconds", Value.ForNumber(DefaultExtendedSessionIdleTimeoutInSeconds) } });
7474
byte[] requestBytes = entityRequest.ToByteArray();
7575
string requestString = Convert.ToBase64String(requestBytes);
76-
string responseString = await GrpcEntityRunner.LoadAndRunAsync(requestString, new SimpleEntity(), extendedSessions);
77-
Protobuf.OrchestratorResponse response = Protobuf.OrchestratorResponse.Parser.ParseFrom(Convert.FromBase64String(responseString));
76+
await GrpcEntityRunner.LoadAndRunAsync(requestString, new SimpleEntity(), extendedSessions);
7877
Assert.False(extendedSessions.IsInitialized);
7978

8079
// Wrong value type for extended session timeout key
@@ -373,7 +372,7 @@ static Protobuf.EntityBatchRequest CreateEntityRequest(IEnumerable<Protobuf.Oper
373372
return entityBatchRequest;
374373
}
375374

376-
class SimpleEntity : TaskEntity<int?>
375+
sealed class SimpleEntity : TaskEntity<int?>
377376
{
378377
public void Set(int value)
379378
{

test/Worker/Grpc.Tests/GrpcOrchestrationRunnerTests.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ public void MalformedRequestParameters_Means_CacheNotInitialized()
120120
{ "ExtendedSessionsIdleTimeoutInSeconds", Value.ForNumber(DefaultExtendedSessionIdleTimeoutInSeconds) } });
121121
byte[] requestBytes = orchestratorRequest.ToByteArray();
122122
string requestString = Convert.ToBase64String(requestBytes);
123-
string responseString = GrpcOrchestrationRunner.LoadAndRun(requestString, new SimpleOrchestrator(), extendedSessions);
124-
Protobuf.OrchestratorResponse response = Protobuf.OrchestratorResponse.Parser.ParseFrom(Convert.FromBase64String(responseString));
123+
GrpcOrchestrationRunner.LoadAndRun(requestString, new SimpleOrchestrator(), extendedSessions);
125124
Assert.False(extendedSessions.IsInitialized);
126125

127126
// Wrong value type for extended session timeout key

0 commit comments

Comments
 (0)