[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: [ANN] forkoff - parallel processing for ruby enumerables

Brandon Hoult

4/21/2008 8:39:00 PM

[Note: parts of this message were removed to make it a legal post.]

I had some issues using active record objects inside the code block. It
seems that activerecord does not allow concurrency by default, and I ended
up with "MySQL server has gone away" messages as a result.

I found a couple of possible fixes here
http://www.ruby-forum.com/to..., and am not sure which one is best to
use.

The first is just to add "ActiveRecord::Base.allow_concurrency = true" which
seems to work fine for me and is certainly the simplest.

The other is to "ActiveRecord::Base.remove_connection" before forkoff! then
"ActiveRecord::Base.establish_connection(dbconfig)" first thing in the code
block, then "ActiveRecord::Base.establish_connection(dbconfig)" after
forkoff.

If the second method is better then it would probably be best added to the
gem. Any advice?

2 Answers

ara.t.howard

4/21/2008 10:51:00 PM

0


On Apr 21, 2008, at 2:39 PM, Brandon Hoult wrote:
> The other is to "ActiveRecord::Base.remove_connection" before
> forkoff! then
> "ActiveRecord::Base.establish_connection(dbconfig)" first thing in
> the code
> block, then "ActiveRecord::Base.establish_connection(dbconfig)" after
> forkoff.
>
> If the second method is better then it would probably be best added
> to the
> gem. Any advice?

this is purely an active record issue - nothing to do with forkoff.
the ar code doesn't carry itself across a fork - there are a few
patches out there that fix this - one by a guy in denver - can't
recall his name - anyone?

a @ http://codeforp...
--
we can deny everything, except that we have the possibility of being
better. simply reflect on that.
h.h. the 14th dalai lama




Abdul-rahman Advany

4/29/2008 9:15:00 PM

0

Check out the code for spawn, the guys have fixed this
--
Posted via http://www.ruby-....