diff options
author | Don Jayamanne <don.jayamanne@outlook.com> | 2024-03-27 05:48:23 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-26 18:48:23 +0000 |
commit | 9841d3fdf1f8eebb318a9e37a10ebc903d104782 (patch) | |
tree | cd41f4cf2312beb34f12947563979459a1ed040b /cli/tools/jupyter | |
parent | a2a537e196360c5e44821f3bff901bd478ab8156 (diff) |
fix(kernel): Do not increase counter if store_history=false (#20848)
Fixes https://github.com/denoland/deno/issues/20847
Co-authored-by: Nathan Whitaker <nathan@deno.com>
Diffstat (limited to 'cli/tools/jupyter')
-rw-r--r-- | cli/tools/jupyter/jupyter_msg.rs | 8 | ||||
-rw-r--r-- | cli/tools/jupyter/server.rs | 4 |
2 files changed, 11 insertions, 1 deletions
diff --git a/cli/tools/jupyter/jupyter_msg.rs b/cli/tools/jupyter/jupyter_msg.rs index 8b302bdd8..60703e365 100644 --- a/cli/tools/jupyter/jupyter_msg.rs +++ b/cli/tools/jupyter/jupyter_msg.rs @@ -160,6 +160,14 @@ impl JupyterMessage { self.header["msg_type"].as_str().unwrap_or("") } + pub(crate) fn store_history(&self) -> bool { + self.content["store_history"].as_bool().unwrap_or(true) + } + + pub(crate) fn silent(&self) -> bool { + self.content["silent"].as_bool().unwrap_or(false) + } + pub(crate) fn code(&self) -> &str { self.content["code"].as_str().unwrap_or("") } diff --git a/cli/tools/jupyter/server.rs b/cli/tools/jupyter/server.rs index f6218956d..cd02b9891 100644 --- a/cli/tools/jupyter/server.rs +++ b/cli/tools/jupyter/server.rs @@ -341,7 +341,9 @@ impl JupyterServer { msg: JupyterMessage, connection: &mut Connection<zeromq::RouterSocket>, ) -> Result<(), AnyError> { - self.execution_count += 1; + if !msg.silent() && msg.store_history() { + self.execution_count += 1; + } *self.last_execution_request.borrow_mut() = Some(msg.clone()); msg |