Merge pull request #1721 from ether/dont-send-same-cs-spam

temp patch for #1652
pull/1736/head
John McLear 2013-04-15 04:20:05 -07:00
commit c3c7a3d128
1 changed files with 7 additions and 0 deletions

View File

@ -1663,9 +1663,16 @@ exports.appendATextToAssembler = function (atext, assem) {
* @param cs {Changeset} * @param cs {Changeset}
* @param pool {AtributePool} * @param pool {AtributePool}
*/ */
var lastEvent = null; // This is just a temporary measure to ensure we don't send the exact same changeset twice
// Documentation for this is available at https://github.com/ether/etherpad-lite/issues/1652
exports.prepareForWire = function (cs, pool) { exports.prepareForWire = function (cs, pool) {
if(cs == lastEvent){
throw new Error("Not sending the same event twice...");
}
var newPool = new AttributePool(); var newPool = new AttributePool();
var newCs = exports.moveOpsToNewPool(cs, pool, newPool); var newCs = exports.moveOpsToNewPool(cs, pool, newPool);
lastEvent = cs;
return { return {
translated: newCs, translated: newCs,
pool: newPool pool: newPool