Show More
@@ -34,7 +34,6 b' function(WidgetManager, _, Backbone){' | |||
|
34 | 34 | this.widget_manager = widget_manager; |
|
35 | 35 | this._buffered_state_diff = {}; |
|
36 | 36 | this.pending_msgs = 0; |
|
37 | this.msg_throttle = 3; | |
|
38 | 37 | this.msg_buffer = null; |
|
39 | 38 | this.key_value_lock = null; |
|
40 | 39 | this.id = model_id; |
@@ -110,7 +109,7 b' function(WidgetManager, _, Backbone){' | |||
|
110 | 109 | // Send buffer if this message caused another message to be |
|
111 | 110 | // throttled. |
|
112 | 111 | if (this.msg_buffer !== null && |
|
113 | this.msg_throttle === this.pending_msgs) { | |
|
112 | (this.get('msg_throttle') || 3) === this.pending_msgs) { | |
|
114 | 113 | var data = {method: 'backbone', sync_method: 'update', sync_data: this.msg_buffer}; |
|
115 | 114 | this.comm.send(data, callbacks); |
|
116 | 115 | this.msg_buffer = null; |
@@ -179,7 +178,7 b' function(WidgetManager, _, Backbone){' | |||
|
179 | 178 | var callbacks = options.callbacks || this.callbacks(); |
|
180 | 179 | |
|
181 | 180 | // Check throttle. |
|
182 | if (this.pending_msgs >= this.msg_throttle) { | |
|
181 | if (this.pending_msgs >= (this.get('msg_throttle') || 3)) { | |
|
183 | 182 | // The throttle has been exceeded, buffer the current msg so |
|
184 | 183 | // it can be sent once the kernel has finished processing |
|
185 | 184 | // some of the existing messages. |
@@ -17,7 +17,7 b' from contextlib import contextmanager' | |||
|
17 | 17 | from IPython.core.getipython import get_ipython |
|
18 | 18 | from IPython.kernel.comm import Comm |
|
19 | 19 | from IPython.config import LoggingConfigurable |
|
20 | from IPython.utils.traitlets import Unicode, Dict, Instance, Bool, List, Tuple | |
|
20 | from IPython.utils.traitlets import Unicode, Dict, Instance, Bool, List, Tuple, Int | |
|
21 | 21 | from IPython.utils.py3compat import string_types |
|
22 | 22 | |
|
23 | 23 | #----------------------------------------------------------------------------- |
@@ -103,6 +103,8 b' class Widget(LoggingConfigurable):' | |||
|
103 | 103 | _comm = Instance('IPython.kernel.comm.Comm') |
|
104 | 104 | |
|
105 | 105 | closed = Bool(False) |
|
106 | msg_throttle = Int(3, sync=True, help="""Maximum number of msgs the | |
|
107 | front-end can send before receiving an idle msg from the back-end.""") | |
|
106 | 108 | |
|
107 | 109 | keys = List() |
|
108 | 110 | def _keys_default(self): |
General Comments 0
You need to be logged in to leave comments.
Login now