Skip to content

Commit 8074cce

Browse files
Copilotedburns
andauthored
Deduplicate success log in JsonRpcClient.invoke
Log success once after deserialization (or null for Void) rather than duplicating the logTiming call in both branches. Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
1 parent 24cb65d commit 8074cce

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

src/main/java/com/github/copilot/sdk/JsonRpcClient.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,10 @@ public <T> CompletableFuture<T> invoke(String method, Object params, Class<T> re
124124

125125
return future.thenApply(result -> {
126126
try {
127-
if (responseType == Void.class || responseType == void.class) {
128-
LoggingHelpers.logTiming(LOG, Level.FINE,
129-
"JsonRpc.invoke JSON-RPC request finished. Elapsed={Elapsed}, Method=" + method
130-
+ ", RequestId=" + id + ", Status=Succeeded",
131-
timingNanos);
132-
return null;
127+
T value = null;
128+
if (responseType != Void.class && responseType != void.class) {
129+
value = MAPPER.treeToValue(result, responseType);
133130
}
134-
T value = MAPPER.treeToValue(result, responseType);
135131
LoggingHelpers.logTiming(LOG, Level.FINE,
136132
"JsonRpc.invoke JSON-RPC request finished. Elapsed={Elapsed}, Method=" + method + ", RequestId="
137133
+ id + ", Status=Succeeded",

0 commit comments

Comments
 (0)