i thought AR was thread-safe in 2.2 ? On Tue, Jan 13, 2009 at 9:24 PM, Xie Hanjian <[email protected]> wrote:
> Hi Hubert, > > If @file.convert is high cpu intensive task, you'd better use workers at > background with a queue, or try jruby since MRI use green threads. > > Jan > > * Hubert Łępicki <[email protected]> [2009-01-12 03:54:34 -0800]: > > > > > Hi guys, > > > > I am writing application that is converting files from one format to > > another. The process takes some time for larger files, and I want to > > run it in backround. My application is running in threaded mode > > (enabled in environment.rb) and I know Rails 2.2.2 is thread safe. > > > > Can I simply do in my controller: > > > > def create > > @file = MyFile.new(params[:file]) > > @file.save > > Thread.new { > > @file.convert > > } > > end > > > > This seems to be working fine, but should I expect any problems or > > this is allowed in Rails 2.2.2, please? > > > > > > -- > jan=callcc{|jan|jan};jan.call(jan) > --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

