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) {
|
||||
if (ctx.instance) {
|
||||
ctx.Model.rectifyChange(ctx.instance.getId(), reportErrorAndNext);
|
||||
var instance = ctx.instance || ctx.currentInstance;
|
||||
var id = instance ? instance.getId() :
|
||||
getIdFromWhereByModelId(ctx.Model, ctx.where);
|
||||
|
||||
if (id) {
|
||||
ctx.Model.rectifyChange(id, reportErrorAndNext);
|
||||
} else {
|
||||
ctx.Model.rectifyAllChanges(reportErrorAndNext);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue