mercredi 28 octobre 2015

Multi-thread bug in rake task

I use Rails 3.2.22 and the gem Parallel. And I think I'm gonna be crazy because of class loading.

I use DelayedJob background job on Heroku and randomly some of my class is not defined and I have this kind of error NameError: uninitialized constant RequestAvailabilityForRoutes. So the first thing I've checked is to know if my class was well defined. So I've tried with no multi-thread, it seems working, but I want to use multi-thread..

Next, I've tried to change my autoload paths and follow this tutorial... Of course, no effect appeared...

And finally I find this issue http://ift.tt/1ka75w6. But I don't understand how to not fallback in non-thread-safe autoloading ..

My configuration in production is :

config.threadsafe!
config.dependency_loading = true if $rails_rake_task

What I'm doing wrong ? Is the gem I use ? There is a workaround I didn't know ?

Please help me.

Aucun commentaire:

Enregistrer un commentaire