[CDBI] Forking and reconnecting to the database

Aaron Trevena aaron.trevena at gmail.com
Wed Mar 8 11:14:04 GMT 2006


On 08/03/06, Aaron Trevena <aaron.trevena at gmail.com> wrote:
> On 07/03/06, Perrin Harkins <perrin at elem.com> wrote:
> > Nevertheless, you really do need to do it if you want to use Class::DBI
> > safely in a forking server.  The code in the above post came from a lot
> > of difficult debugging of a forking perl daemon, just like what you're
> > describing, and it's significantly trickier to make that work than just
> > getting Class::DBI to be mod_perl-safe.  We didn't even notice the
> > problem until we had an initial version in production because it's very
> > unpredictable.

I just dumped the _mk_db_closure sub into my CDBI superclass that all
my classes inherit from and the db connection issues have gone away...

Thanks again, perrin - if this was in Ima::DBI it would be incredibly handy.

That just leaves me fine tuning the IPC between slave and master
processes to track what tasks were complete.

If anybody is interested I should have a pretty cool (IMHO)
distributed and time/resource/rule constrained scheduling system ready
for cpan around the start of April after we've put it into production.
It has a CDBI (on Mysql or Postgres depending on minimal hacking)
backend and a Maypole frontend (which is seperate and not required).

I think it could kick quartz' ass in several areas, but again thats
just IMHO and YMMV.

Cheers,

A.




More information about the ClassDBI mailing list