diff --git a/IPython/html/static/notebook/js/widgets/widget.js b/IPython/html/static/notebook/js/widgets/widget.js index 8f69a7d..27180c8 100644 --- a/IPython/html/static/notebook/js/widgets/widget.js +++ b/IPython/html/static/notebook/js/widgets/widget.js @@ -34,7 +34,6 @@ function(WidgetManager, _, Backbone){ this.widget_manager = widget_manager; this._buffered_state_diff = {}; this.pending_msgs = 0; - this.msg_throttle = 3; this.msg_buffer = null; this.key_value_lock = null; this.id = model_id; @@ -110,7 +109,7 @@ function(WidgetManager, _, Backbone){ // Send buffer if this message caused another message to be // throttled. if (this.msg_buffer !== null && - this.msg_throttle === this.pending_msgs) { + (this.get('msg_throttle') || 3) === this.pending_msgs) { var data = {method: 'backbone', sync_method: 'update', sync_data: this.msg_buffer}; this.comm.send(data, callbacks); this.msg_buffer = null; @@ -179,7 +178,7 @@ function(WidgetManager, _, Backbone){ var callbacks = options.callbacks || this.callbacks(); // Check throttle. - if (this.pending_msgs >= this.msg_throttle) { + if (this.pending_msgs >= (this.get('msg_throttle') || 3)) { // The throttle has been exceeded, buffer the current msg so // it can be sent once the kernel has finished processing // some of the existing messages. diff --git a/IPython/html/widgets/widget.py b/IPython/html/widgets/widget.py index 57ccea0..4c576b3 100644 --- a/IPython/html/widgets/widget.py +++ b/IPython/html/widgets/widget.py @@ -17,7 +17,7 @@ from contextlib import contextmanager from IPython.core.getipython import get_ipython from IPython.kernel.comm import Comm from IPython.config import LoggingConfigurable -from IPython.utils.traitlets import Unicode, Dict, Instance, Bool, List, Tuple +from IPython.utils.traitlets import Unicode, Dict, Instance, Bool, List, Tuple, Int from IPython.utils.py3compat import string_types #----------------------------------------------------------------------------- @@ -103,6 +103,8 @@ class Widget(LoggingConfigurable): _comm = Instance('IPython.kernel.comm.Comm') closed = Bool(False) + msg_throttle = Int(3, sync=True, help="""Maximum number of msgs the + front-end can send before receiving an idle msg from the back-end.""") keys = List() def _keys_default(self):