I work on a fairly large website that uses Ruby 1.8.6 and Rails 1.2.3. We cannot upgrade as it will hopelessly break our code. We are working on a new version in Java but for the next year at least we are stuck with the legacy system. We use the latest version of Postgresql for the database using the postgres-pr gem.
I am attempting to implement cron tasks within the system using Rufus Scheduler, which is sort of a lighter-weight version of BackgrounDRb. I found very quickly that if I have 2 tasks (threads) running and they both attempt to use ActiveRecord, they deadlock. Supposedly ActiveRecord has a means of enabling concurrency, however the postgres-pr adapter does not support this.
I've been trying without luck to install one of the alternative postgres adapters that supposedly support concurrency. The 'pg' one appears to be the latest and official gem, and it installs fine. However, when I attempt to access a page, I get: "no such file to load -- postgres". I have scoured Google for this error string, but the results have not been helpful.
So my first question is: what's the deal with this? Also: How do you guys use threads in your Rails apps?
By the way, I am developing on a Windows box, though our production systems are FreeBSD.
Thanks
If you want to continue reading, I have more random notes:
I did attempt to install some of the deprecated gems, with no success. The old postgres gem and ruby-pg fail when trying to build native extensions, even when I point them to the postgres install dir (I probably don't have the necessary dev tools on my workstation). Ruby-postgres (the older version of pg) installs find but doesn't play nicely with the latest version of postgresql, throwing operating system errors. Really all of this should matter though as the pg gem is the one I should be using.
Is there a way to get concurrency working with postgres-pr, or does using that adapter mean you just can't use threads? Seems pretty piss poor, but typical I guess.
Even if I do get the adapter working, do I have to worry about deadlock in other parts of Rails besides ActiveRecord?