Coalesce adjacent patch actions from a given pid
This commit is contained in:
parent
2c78d1ad0a
commit
e3520ac711
|
@ -86,12 +86,9 @@ Actor.prototype.quiesce = function() {
|
|||
var facet = subjectId[0];
|
||||
var endpoint = subjectId[1];
|
||||
withCurrentFacet(facet, function () {
|
||||
// TODO: coalesce patches within a single actor
|
||||
var aggregate = Patch.emptyPatch;
|
||||
var patch = Patch.retract(__).andThen(endpoint.subscriptionFn.call(facet.fields));
|
||||
var r = facet.actor.mux.updateStream(endpoint.eid, patch);
|
||||
aggregate = aggregate.andThen(r.deltaAggregate);
|
||||
Dataspace.stateChange(aggregate);
|
||||
Dataspace.stateChange(r.deltaAggregate);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -203,6 +203,15 @@ Dataspace.prototype.step = function () {
|
|||
};
|
||||
|
||||
Dataspace.prototype.enqueueAction = function (pid, action) {
|
||||
if (action.type === 'stateChange') {
|
||||
var newestEntry = this.pendingActions.last();
|
||||
if (newestEntry && newestEntry[0] === pid && newestEntry[1].type === 'stateChange') {
|
||||
var combinedPatch = newestEntry[1].patch.andThen(action.patch);
|
||||
this.pendingActions = this.pendingActions.pop().push([pid, stateChange(combinedPatch)]);
|
||||
return;
|
||||
}
|
||||
/* fall through */
|
||||
}
|
||||
this.pendingActions = this.pendingActions.push([pid, action]);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue