Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transactions on Rectify #3027

Closed
1 of 2 tasks
kobaska opened this issue Dec 14, 2016 · 5 comments
Closed
1 of 2 tasks

Transactions on Rectify #3027

kobaska opened this issue Dec 14, 2016 · 5 comments

Comments

@kobaska
Copy link
Contributor

kobaska commented Dec 14, 2016

Bug or feature request

  • Bug
  • Feature request

Description of feature

Pass transaction through to rectifyOnSave and rectifyOnDelete functions which get called on the after save and after delete hooks.

@kobaska
Copy link
Contributor Author

kobaska commented Dec 15, 2016

I see two options we could do:

  1. 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) {
}

  1. 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);
 }
});

@kobaska
Copy link
Contributor Author

kobaska commented Dec 21, 2016

Hey @bajtos, Can you please give your view on this, whether transaction is something you have thought about in replication scenarios?

@bajtos
Copy link
Member

bajtos commented Dec 22, 2016

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?

@ericmorentin
Copy link

Greetings. I am a college of @kobaska. Am starting work on adding options to rectify methods this week.

@bajtos
Copy link
Member

bajtos commented Jan 23, 2017

@ericmorentin Great, I'm looking forward to your contribution(s)!

@stale stale bot added the stale label Aug 23, 2017
@stale stale bot closed this as completed Sep 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants