Transactions on Rectify
Bug or feature request
- [ ] Bug
- [x] Feature request
Description of feature
Pass transaction through to rectifyOnSave and rectifyOnDelete functions which get called on the after save and after delete hooks.
I see two options we could do:
- Pass options object through to all the calls related to rectify which means we have to add options to PersistedModel.rectifyChange, Change.rectifyAllChanges and Change.rectifyModelChanges:
PersistedModel.rectifyChange = function(id, options, callback) { ..... };
Change.rectifyModelChanges = function(modelName, modelIds, options, callback) { }
- Disable rectify when transaction exist, let the client handle rectify (Which is not great)
From : Model.observe('after save', rectifyOnSave);
To:
Model.observe('after save', function(ctx, next) {
if (ctx.options.transaction) {
next();
} else {
rectifyOnSave(ctx, next);
}
});
Hey @bajtos, Can you please give your view on this, whether transaction is something you have thought about in replication scenarios?
Hi @kobaska, your first proposal makes a lot of sense to me, we should add options argument to rectify* methods. This will also enable context-propagation as proposed/implemented by #3023 (see also #1495).
Would you mind contributing this improvement yourself?
Greetings. I am a college of @kobaska. Am starting work on adding options to rectify methods this week.
@ericmorentin Great, I'm looking forward to your contribution(s)!