Disable conf_cache by default, enable it only when safe to do so
[freeside.git] / htetc / handler.pl
index d7c5657..18108ab 100644 (file)
@@ -6,12 +6,24 @@ use strict;
 use warnings;
 use FS::Mason qw( mason_interps );
 use FS::Trace;
+use FS::Conf;
+
+$FS::Conf::conf_cache_enabled = 1; # enable FS::Conf caching for performance
 
 if ( %%%RT_ENABLED%%% ) {
+
   require RT;
+
   $> = scalar(getpwnam('freeside'));
+
   RT::LoadConfig();
   RT::Init();
+
+  # disconnect DB before fork:
+  #   (avoid 'prepared statement "dbdpg_p\d+_\d+" already exists' errors?)
+  $RT::Handle->dbh(undef);
+  undef $RT::Handle;
+
   $> = $<;
 }