mirror of
https://github.com/jupyter/notebook.git
synced 2025-02-05 12:19:58 +08:00
Increment the pending_msgs counter immediately to avoid race conditions that send more messages
This commit is contained in:
parent
c9f3c8e073
commit
c70f687c0e
@ -347,6 +347,7 @@ define(["widgets/js/manager",
|
|||||||
// We haven't exceeded the throttle, send the message like
|
// We haven't exceeded the throttle, send the message like
|
||||||
// normal.
|
// normal.
|
||||||
this.send_sync_message(attrs, callbacks);
|
this.send_sync_message(attrs, callbacks);
|
||||||
|
this.pending_msgs++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Since the comm is a one-way communication, assume the message
|
// Since the comm is a one-way communication, assume the message
|
||||||
@ -395,8 +396,11 @@ define(["widgets/js/manager",
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
that.comm.send({method: 'backbone', sync_data: state, buffer_keys: buffer_keys}, callbacks, {}, buffers);
|
that.comm.send({method: 'backbone', sync_data: state, buffer_keys: buffer_keys}, callbacks, {}, buffers);
|
||||||
that.pending_msgs++;
|
}).catch(utils.reject("Couldn't send widget sync message"), true)
|
||||||
})
|
.catch(function(error) {
|
||||||
|
that.pending_msgs--;
|
||||||
|
return error;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
serialize: function(model, attrs) {
|
serialize: function(model, attrs) {
|
||||||
|
Loading…
Reference in New Issue
Block a user