From 53f79da09d5da542204f3cb0161724221276dfcb Mon Sep 17 00:00:00 2001 From: Crispin Wellington Date: Mon, 12 Sep 2022 18:43:15 +0800 Subject: [PATCH 1/2] set TCP_NODELAY on transport socket (#55) --- src/babashka/pods/impl.clj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/babashka/pods/impl.clj b/src/babashka/pods/impl.clj index 52146b8..58b6d94 100644 --- a/src/babashka/pods/impl.clj +++ b/src/babashka/pods/impl.clj @@ -292,7 +292,8 @@ the socket is connected." ^Socket [^String hostname ^Integer port] - (Socket. hostname port)) + (doto (Socket. hostname port) + (.setTcpNoDelay true))) (defn close-socket "Close the socket, and also closes its input and output streams." From decf791000081ca9e6d2fbea9f20a0aa3fae902e Mon Sep 17 00:00:00 2001 From: Nate Jones Date: Thu, 29 Sep 2022 00:27:03 -0700 Subject: [PATCH 2/2] Switch "out" and "err" messages to print and flush instead of println (#57) --- src/babashka/pods/impl.clj | 9 ++++++--- test-pod/pod/test_pod.clj | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/babashka/pods/impl.clj b/src/babashka/pods/impl.clj index 58b6d94..eded61e 100644 --- a/src/babashka/pods/impl.clj +++ b/src/babashka/pods/impl.clj @@ -219,9 +219,12 @@ ;; listening to output synchronous. (when out (binding [*out* out-stream] - (println out))) - (when err (binding [*out* err-stream] - (println err))) + (print out) + (.flush ^java.io.Writer out-stream))) + (when err + (binding [*out* err-stream] + (print err) + (.flush ^java.io.Writer err-stream))) (when (or value* error? namespace) (cond promise? (deliver chan (cond error? exception diff --git a/test-pod/pod/test_pod.clj b/test-pod/pod/test_pod.clj index 8e483b5..7fb8506 100644 --- a/test-pod/pod/test_pod.clj +++ b/test-pod/pod/test_pod.clj @@ -207,14 +207,14 @@ "id" id}) pod.test-pod/print (do (write out - {"out" (pr-str args) + {"out" (with-out-str (prn args)) "id" id}) (write out {"status" ["done"] "id" id})) pod.test-pod/print-err (do (write out - {"err" (pr-str args) + {"err" (with-out-str (prn args)) "id" id}) (write out {"status" ["done"]