projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
should fix intermittant slowness, RT#18719
[freeside.git]
/
htetc
/
handler.pl
diff --git
a/htetc/handler.pl
b/htetc/handler.pl
index
cea3661
..
d7c5657
100644
(file)
--- a/
htetc/handler.pl
+++ b/
htetc/handler.pl
@@
-5,6
+5,15
@@
package HTML::Mason;
use strict;
use warnings;
use FS::Mason qw( mason_interps );
use strict;
use warnings;
use FS::Mason qw( mason_interps );
+use FS::Trace;
+
+if ( %%%RT_ENABLED%%% ) {
+ require RT;
+ $> = scalar(getpwnam('freeside'));
+ RT::LoadConfig();
+ RT::Init();
+ $> = $<;
+}
#use vars qw($r);
#use vars qw($r);
@@
-38,6
+47,8
@@
sub handler
#($r) = @_;
my $r = shift;
#($r) = @_;
my $r = shift;
+ FS::Trace->log('protecting fds');
+
#from rt/bin/webmux.pl(.in)
if ( !$protect_fds && $ENV{'MOD_PERL'} && exists $ENV{'MOD_PERL_API_VERSION'}
&& $ENV{'MOD_PERL_API_VERSION'} >= 2
#from rt/bin/webmux.pl(.in)
if ( !$protect_fds && $ENV{'MOD_PERL'} && exists $ENV{'MOD_PERL_API_VERSION'}
&& $ENV{'MOD_PERL_API_VERSION'} >= 2
@@
-63,6
+74,8
@@
sub handler
###Module::Refresh->refresh;###
###Module::Refresh->refresh;###
+ FS::Trace->log('setting content_type / headers');
+
$r->content_type('text/html; charset=utf-8');
#$r->content_type('text/html; charset=iso-8859-1');
#eorar
$r->content_type('text/html; charset=utf-8');
#$r->content_type('text/html; charset=iso-8859-1');
#eorar
@@
-76,6
+89,8
@@
sub handler
if ( $r->filename =~ /\/rt\// ) { #RT
if ( $r->filename =~ /\/rt\// ) { #RT
+ FS::Trace->log('handling RT file');
+
# We don't need to handle non-text, non-xml items
return -1 if defined( $r->content_type )
&& $r->content_type !~ m!(^text/|\bxml\b)!io;
# We don't need to handle non-text, non-xml items
return -1 if defined( $r->content_type )
&& $r->content_type !~ m!(^text/|\bxml\b)!io;
@@
-84,15
+99,20
@@
sub handler
local $SIG{__WARN__};
local $SIG{__DIE__};
local $SIG{__WARN__};
local $SIG{__DIE__};
+ FS::Trace->log('initializing RT');
my_rt_init();
my_rt_init();
+ FS::Trace->log('setting RT interpreter');
$ah->interp($rt_interp);
} else {
$ah->interp($rt_interp);
} else {
+ FS::Trace->log('handling Freeside file');
+
local $SIG{__WARN__};
local $SIG{__DIE__};
local $SIG{__WARN__};
local $SIG{__DIE__};
+ FS::Trace->log('initializing RT');
my_rt_init();
#we don't want the RT error handlers under FS
my_rt_init();
#we don't want the RT error handlers under FS
@@
-102,10
+122,12
@@
sub handler
undef($SIG{__DIE__}) if defined($SIG{__DIE__} );
}
undef($SIG{__DIE__}) if defined($SIG{__DIE__} );
}
+ FS::Trace->log('setting Freeside interpreter');
$ah->interp($fs_interp);
}
$ah->interp($fs_interp);
}
+ FS::Trace->log('handling request');
my %session;
my $status;
eval { $status = $ah->handle_request($r); };
my %session;
my $status;
eval { $status = $ah->handle_request($r); };
@@
-125,22
+147,22
@@
sub handler
# );
# }
# );
# }
+ FS::Trace->log('done');
+
+ FS::Trace->dumpfile( "%%%FREESIDE_EXPORT%%%/profile/$$.".time,
+ FS::Trace->total. ' '. $r->filename
+ )
+ if FS::Trace->total > 5; #10?
+
+ FS::Trace->reset;
+
$status;
}
$status;
}
-my $rt_initialized = 0;
-
sub my_rt_init {
return unless $RT::VERSION;
sub my_rt_init {
return unless $RT::VERSION;
-
- if ( $rt_initialized ) {
- RT::ConnectToDatabase();
- RT::InitSignalHandlers();
- } else {
- RT::LoadConfig();
- RT::Init();
- $rt_initialized++;
- }
+ RT::ConnectToDatabase();
+ RT::InitSignalHandlers();
}
1;
}
1;