Hey everyone. I am trying to run a an external process after a update from the view. I currently have it set up to run after_update but it seems that the transaction it uses hasn''t been closed at that point. My process is supposed to check some variables in the database and change a specific column in the database. Now because the transaction hasn''t been closed it results in a deadlock. Does any one have a good work around to achieve this? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
InnerSparkMedia wrote:> I am trying to run a an external process after a update from the view. > I currently have it set up to run after_update but it seems that the > transaction it uses hasn''t been closed at that point. My process is > supposed to check some variables in the database and change a specific > column in the database. Now because the transaction hasn''t been closed > it results in a deadlock. Does any one have a good work around to > achieve this?One hack is to put something like "sleep 2" at the beginning of the external process. Or call the external process from your controller. Or change the transaction visibility level of your external-process DB connection. But it''d be nice if transaction calls could again take model instance parameters, allowing implementation of an after_commit callback. -- We develop, watch us RoR, in numbers too big to ignore. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
How do you go about calling say a model method from the controller? Because my call to the external process is defined in the model. On Feb 18, 3:08 pm, Mark Reginald James <m...-bzGI/hKkdgQnC9Muvcwxkw@public.gmane.org> wrote:> InnerSparkMedia wrote: > > I am trying to run a an external process after a update from the view. > > I currently have it set up to run after_update but it seems that the > > transaction it uses hasn''t been closed at that point. My process is > > supposed to check some variables in the database and change a specific > > column in the database. Now because the transaction hasn''t been closed > > it results in a deadlock. Does any one have a good work around to > > achieve this? > > One hack is to put something like "sleep 2" at the beginning of the > external process. Or call the external process from your controller. > Or change the transaction visibility level of your external-process > DB connection. > > But it''d be nice if transaction calls could again take model instance > parameters, allowing implementation of an after_commit callback. > > -- > We develop, watch us RoR, in numbers too big to ignore.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
or just the external process? On Feb 18, 3:16 pm, InnerSparkMedia <BinderInteractive.Me...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> How do you go about calling say a model method from the controller? > Because my call to the external process is defined in the model. > > On Feb 18, 3:08 pm, Mark Reginald James <m...-bzGI/hKkdgQnC9Muvcwxkw@public.gmane.org> wrote: > > > InnerSparkMedia wrote: > > > I am trying to run a an external process after a update from the view. > > > I currently have it set up to run after_update but it seems that the > > > transaction it uses hasn''t been closed at that point. My process is > > > supposed to check some variables in the database and change a specific > > > column in the database. Now because the transaction hasn''t been closed > > > it results in a deadlock. Does any one have a good work around to > > > achieve this? > > > One hack is to put something like "sleep 2" at the beginning of the > > external process. Or call the external process from your controller. > > Or change the transaction visibility level of your external-process > > DB connection. > > > But it''d be nice if transaction calls could again take model instance > > parameters, allowing implementation of an after_commit callback. > > > -- > > We develop, watch us RoR, in numbers too big to ignore.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Also when dose a transaction end? On Feb 18, 3:16 pm, InnerSparkMedia <BinderInteractive.Me...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> How do you go about calling say a model method from the controller? > Because my call to the external process is defined in the model. > > On Feb 18, 3:08 pm, Mark Reginald James <m...-bzGI/hKkdgQnC9Muvcwxkw@public.gmane.org> wrote: > > > InnerSparkMedia wrote: > > > I am trying to run a an external process after a update from the view. > > > I currently have it set up to run after_update but it seems that the > > > transaction it uses hasn''t been closed at that point. My process is > > > supposed to check some variables in the database and change a specific > > > column in the database. Now because the transaction hasn''t been closed > > > it results in a deadlock. Does any one have a good work around to > > > achieve this? > > > One hack is to put something like "sleep 2" at the beginning of the > > external process. Or call the external process from your controller. > > Or change the transaction visibility level of your external-process > > DB connection. > > > But it''d be nice if transaction calls could again take model instance > > parameters, allowing implementation of an after_commit callback. > > > -- > > We develop, watch us RoR, in numbers too big to ignore.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
InnerSparkMedia wrote:> Also when dose a transaction end?You can put your call to the external process after the end of the transaction "do" block (or after the save for automatic transaction wrappings). Just call Model.method if the process can be started by a class method of Model. -- We develop, watch us RoR, in numbers too big to ignore. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thank you for your help. They did it. What I had to do was place @model.method in the if saved statement and it worked. On Feb 18, 3:26 pm, Mark Reginald James <m...-bzGI/hKkdgQnC9Muvcwxkw@public.gmane.org> wrote:> InnerSparkMedia wrote: > > Also when dose a transaction end? > > You can put your call to the external process after the > end of the transaction "do" block (or after the save for > automatic transaction wrappings). > > Just call Model.method if the process can be started by a > class method of Model. > > -- > We develop, watch us RoR, in numbers too big to ignore.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---