Merge pull request #1681 from strongloop/fix/replication-perf-on-save
Fix perf of rectification after updateAttributes
This commit is contained in:
commit
c87bf9a1da
|
@ -1425,8 +1425,12 @@ module.exports = function(registry) {
|
||||||
};
|
};
|
||||||
|
|
||||||
function rectifyOnSave(ctx, next) {
|
function rectifyOnSave(ctx, next) {
|
||||||
if (ctx.instance) {
|
var instance = ctx.instance || ctx.currentInstance;
|
||||||
ctx.Model.rectifyChange(ctx.instance.getId(), reportErrorAndNext);
|
var id = instance ? instance.getId() :
|
||||||
|
getIdFromWhereByModelId(ctx.Model, ctx.where);
|
||||||
|
|
||||||
|
if (id) {
|
||||||
|
ctx.Model.rectifyChange(id, reportErrorAndNext);
|
||||||
} else {
|
} else {
|
||||||
ctx.Model.rectifyAllChanges(reportErrorAndNext);
|
ctx.Model.rectifyAllChanges(reportErrorAndNext);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue