Maybe no one has a real answer for you :)

From my experience, if you're running ActiveRecord code, you could
have a problem. I tried to use active record on non controller threads
(even using with_connection) and it didn't work. If you're not using
ActiveRecord, it shoudn't be an issue, just don't forget that the MRI
isn't really concurrent and you'll just get real concurrency running
on JRuby.

-
Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en)



2009/1/13 Hubert Łępicki <[email protected]>:
>
> Pff,
>
> what's wrong with you guys -- each time I need answer: nothing!
>
>
>
> On 12 Sty, 12:54, Hubert Łępicki <[email protected]> wrote:
>> 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?
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to