Skip to content

Commit

Permalink
provide some top level comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rgbkrk committed Sep 28, 2017
1 parent b884ff9 commit 569bb25
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions notebook/services/kernels/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ def post(self, kernel_id, action):


class ZMQChannelsHandler(AuthenticatedZMQStreamHandler):
'''There is one ZMQChannelsHandler per running kernel and it oversees all
the sessions.
'''

# class-level registry of open sessions
# allows checking for conflict on session-id,
Expand Down Expand Up @@ -198,6 +201,10 @@ def initialize(self):
self._kernel_info_future = Future()
self._close_future = Future()
self.session_key = ''

# TODO: the buffer should likely be a memory bounded queue, we're starting with a list to keep it simple
# TODO: Min suggested this should exist on the `Kernel` as well, not in this ZMQChannelsHandler
self.message_buffer = []

# Rate limiting code
self._iopub_window_msg_count = 0
Expand Down Expand Up @@ -257,6 +264,7 @@ def open(self, kernel_id):
super(ZMQChannelsHandler, self).open()
self.kernel_manager.notify_connect(kernel_id)
try:
# TODO: if this is a reconnection, we'll replay messages
self.create_stream()
except web.HTTPError as e:
self.log.error("Error opening stream: %s", e)
Expand Down Expand Up @@ -404,6 +412,8 @@ def close(self):
return self._close_future

def on_close(self):
# TODO: Start buffering messages

self.log.debug("Websocket closed %s", self.session_key)
# unregister myself as an open session (only if it's really me)
if self._open_sessions.get(self.session_key) is self:
Expand Down

0 comments on commit 569bb25

Please sign in to comment.