From d07a0b77e32c6dcf0379a503c533adf8cc4b0e6e Mon Sep 17 00:00:00 2001 From: Knut Wannheden Date: Mon, 14 Oct 2024 18:10:26 +0200 Subject: [PATCH] Use `withNewSocket()` when parsing The Python remoting server currently always closes the socket after each request. --- src/main/java/org/openrewrite/python/PythonParser.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/openrewrite/python/PythonParser.java b/src/main/java/org/openrewrite/python/PythonParser.java index b20ba36..ada9499 100644 --- a/src/main/java/org/openrewrite/python/PythonParser.java +++ b/src/main/java/org/openrewrite/python/PythonParser.java @@ -92,7 +92,7 @@ public Stream parseInputs(Iterable inputs, @Nullable Path rel parsingListener.startedParsing(input); try (EncodingDetectingInputStream is = input.getSource(ctx)) { - SourceFile parsed = client.runUsingSocket((socket, messenger) -> requireNonNull(messenger.sendRequest(generator -> { + SourceFile parsed = client.withNewSocket((socket, messenger) -> requireNonNull(messenger.sendRequest(generator -> { if (input.isSynthetic() || !Files.isRegularFile(input.getPath())) { generator.writeString("parse-python-source"); generator.writeString(is.readFully());