Repository navigation
Stream eval output as it is flushed - #14
Merged
Merged
Conversation
run-eval called the two-argument jolt.nrepl/evaluate, which captures *out*
and returns it whole, so a long eval's output reached the client only when it
finished, and what it printed to *err* went to the server's terminal. It now
passes evaluate's {:out f :err f} (jolt 0.8.13 and later), so each flushed
chunk is sent as an out or err message while the eval runs, as upstream's
session writers do. :jolt/min-version moves to 0.8.13.
Fixes #13.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #13.
run-evalcalled the two-argumentjolt.nrepl/evaluate, which captures*out*and returns it whole. So a long eval's output reached the client only when the eval finished, and anything it printed to*err*went to the server's terminal instead. It now passesevaluate's{:out f :err f}argument (jolt-lang/jolt#1157), so each flushed chunk goes out as anoutorerrmessage while the eval runs, the way upstream's session writers and jolt's built-inevalop do.:jolt/min-versionmoves from 0.8.0 to 0.8.13, the first Jolt with that arity.(when (seq out) ...)stays::outcomes back empty when streaming.evaluatebinds*capturing-thread*in both arities, soout-subscribestill doesn't echo an eval's own output a second time.Tests
Two new tests in
session_test.clj:eval-output-streams-as-it-is-flushed: twoprintlns with a sleep between come back as twooutmessages, before the value.eval-err-output-reaches-the-client: aprintlnto*err*comes back as anerrmessage.Both fail on
mainand pass here.jolt -M:teston Jolt v0.8.22: 80 tests, 173 assertions, 0 failures (78 and 169 onmain).Timed against a real
jolt nrepl-serverusing this branch, evaluating(dotimes [i 3] (println "tick" i) (Thread/sleep 1000)): the ticks arrive at 1, 1031 and 2036 ms and the value at 3041 ms. Onmainall three ticks arrive together at about 3010 ms.