Threading in Rails

Hello,

I was wondering if someone can point me how to invoke threads from an
action
in a controller. Basically, in an action, I want to do some tasks
asynchronously for which user need not wait.

–
Thanks,
Jaikishan

It isn’t safe (at least not now) to create threads in Rails, but you
can use something like Background Job →
http://codeforpeople.com/lib/ruby/bj/bj-1.0.1/README

On Wed, Sep 24, 2008 at 8:15 AM, Jaikishan J. [email protected]
wrote:

–
Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/
(en)
João Pessoa, PB, +55 83 8867-7208

Will look into it.

On Wed, Sep 24, 2008 at 4:49 PM, Maurício Linhares <
[email protected]> wrote:

action

–
Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en)
João Pessoa, PB, +55 83 8867-7208

–
Thanks,
Jaikishan

“Enjoying the rights of being intelligent ignorant”

Does this background job maintains a queue sort of thing? If yes, then
how
does some tasks can be concurrently executed?

On Wed, Sep 24, 2008 at 4:57 PM, Jaikishan J. [email protected]
wrote:

Thanks,
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/(en)
“Enjoying the rights of being intelligent ignorant”

–
Thanks,
Jaikishan

“Enjoying the rights of being intelligent ignorant”

Check out the last two Railscasts.

I think this might be what you need.

Background job usually runs a job at a time, which is cool as Ruby
itself is almost “single threaded”, but if you want a solution with
concurrent job execution, you can try SkyNet →
http://skynet.rubyforge.org/

On Wed, Sep 24, 2008 at 8:29 AM, Jaikishan J. [email protected]
wrote:

Does this background job maintains a queue sort of thing? If yes, then how
does some tasks can be concurrently executed?

–
Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/
(en)
João Pessoa, PB, +55 83 8867-7208

I installed skynet in my rails application using
$skynet_install --rails .

After this, when I try to start my server (Mongreal), it throws me
following
error.

=> Booting Mongrel (use ‘script/server webrick’ to force WEBrick)
=> Rails application starting on http://127.0.0.1:3005
=> Call with -d to detach
=> Ctrl-C to shutdown server
** Starting Mongrel listening at 127.0.0.1:3005
** Starting Rails with development environment…
Exiting
/home/jaikishan/aptana/plugins/org.jruby_1.1.0.5965_RC2p2/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
require': no such file to load -- skynet (MissingSourceFile) from /home/jaikishan/aptana/plugins/org.jruby_1.1.0.5965_RC2p2/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in new_constants_in’
from
/home/jaikishan/aptana/plugins/org.jruby_1.1.0.5965_RC2p2/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:318:in
require' from /home/jaikishan/aptana/plugins/org.jruby_1.1.0.5965_RC2p2/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496 from /home/jaikishan/aptana/plugins/org.jruby_1.1.0.5965_RC2p2/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in require’
from
/home/jaikishan/aptana/plugins/org.jruby_1.1.0.5965_RC2p2/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
require' from /home/jaikishan/aptana/plugins/org.jruby_1.1.0.5965_RC2p2/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in new_constants_in’
from
/home/jaikishan/aptana/plugins/org.jruby_1.1.0.5965_RC2p2/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:318:in
require' from /home/jaikishan/aptana/plugins/org.jruby_1.1.0.5965_RC2p2/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496 ... 35 levels... from /home/jaikishan/aptana/workspace/Analytics/./script/server:3 from -e:2:in load’
from -e:2

What to do now?

On Wed, Sep 24, 2008 at 7:34 PM, Fred [email protected] wrote:

Hello,

–
Thanks,
Jaikishan

“Enjoying the rights of being intelligent ignorant”