From 8b60325f35f017674e9fca7d57b1b564215d0933 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom-Olav=20B=C3=B8yum?= Date: Sun, 20 Oct 2019 20:15:51 +0200 Subject: [PATCH] changed Session.msg_id() property to use session_id and message counter. This gives a unique id but uses much less time --- jupyter_client/session.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/jupyter_client/session.py b/jupyter_client/session.py index 16a9cb634..9491b5d77 100644 --- a/jupyter_client/session.py +++ b/jupyter_client/session.py @@ -527,10 +527,12 @@ def clone(self): new_session.digest_history.update(self.digest_history) return new_session + message_count = 0 @property def msg_id(self): - """always return new uuid""" - return new_id() + message_number = self.message_count + self.message_count += 1 + return '{}_{}'.format(self.session, message_number) def _check_packers(self): """check packers for datetime support."""