##// END OF EJS Templates
Fixed: Last state not being sent to kernel while throttling.
Jonathan Frederic -
Show More
@@ -36,7 +36,7 b' define(["components/underscore/underscore-min",'
36 this.widget_view_types = widget_view_types;
36 this.widget_view_types = widget_view_types;
37 this.pending_msgs = 0;
37 this.pending_msgs = 0;
38 this.msg_throttle = 3;
38 this.msg_throttle = 3;
39 this.msg_buffer = {};
39 this.msg_buffer = null;
40 this.views = {};
40 this.views = {};
41
41
42 // Remember comm associated with the model.
42 // Remember comm associated with the model.
@@ -73,19 +73,21 b' define(["components/underscore/underscore-min",'
73
73
74 // Send buffer if this message caused another message to be
74 // Send buffer if this message caused another message to be
75 // throttled.
75 // throttled.
76 if (this.msg_throttle == this.pending_msgs &&
76 if (this.msg_buffer != null) {
77 this.msg_buffer.length > 0) {
77 if (this.msg_throttle == this.pending_msgs &&
78
78 this.msg_buffer.length > 0) {
79 var output_area = this._get_msg_output_area(msg);
79
80 var callbacks = this._make_callbacks(output_area);
80 var output_area = this._get_msg_output_area(msg);
81 var data = {sync_method: 'patch', sync_data: this.msg_buffer};
81 var callbacks = this._make_callbacks(output_area);
82 comm.send(data, callbacks);
82 var data = {sync_method: 'update', sync_data: this.msg_buffer};
83 this.msg_buffer = {};
83 comm.send(data, callbacks);
84 } else {
84 this.msg_buffer = null;
85 } else {
85
86
86 // Only decrease the pending message count if the buffer
87 // Only decrease the pending message count if the buffer
87 // doesn't get flushed (sent).
88 // doesn't get flushed (sent).
88 --this.pending_msgs;
89 --this.pending_msgs;
90 }
89 }
91 }
90 }
92 }
91 },
93 },
@@ -103,6 +105,9 b' define(["components/underscore/underscore-min",'
103 // it can be sent once the kernel has finished processing
105 // it can be sent once the kernel has finished processing
104 // some of the existing messages.
106 // some of the existing messages.
105 if (method=='patch') {
107 if (method=='patch') {
108 if (this.msg_buffer == null) {
109 this.msg_buffer = $.extend({}, model_json); // Copy
110 }
106 for (var attr in options.attrs) {
111 for (var attr in options.attrs) {
107 this.msg_buffer[attr] = options.attrs[attr];
112 this.msg_buffer[attr] = options.attrs[attr];
108 }
113 }
General Comments 0
You need to be logged in to leave comments. Login now