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


_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/

Reply via email to