[Dbix-class] Disconnecting cleanly
apv
apv at sedition.com
Mon Jan 8 23:54:17 GMT 2007
From the DBIx::Class::Manual::Cookbook
--
Disconnecting cleanly
If you find yourself quitting an app with Control-C a lot during
development, you might like to put the following signal handler in your
main database class to make sure it disconnects cleanly:
$SIG{INT} = sub {
__PACKAGE__->storage->disconnect;
};
--
Looks nice. Are there any caveats with this? If anyone is using it, is
that exactly how you are? Test the handle? Re-die afterward? Plays nice
with Catalyst?
My host (dreamhost) keeps killing my Catalyst apps and I think it might
be causing DB problems over time (the site sometimes goes down
completely) because the DB hangs. This seems a sage approach regardless
of what is causing DB problems.
Thanks!
-Ashley
More information about the Dbix-class
mailing list