Skip to content

Commit

Permalink
Item11879: adding rendering time for cached pages as well. sort of in…
Browse files Browse the repository at this point in the history
…teresting numbers as well measuring foswiki performance ;)

git-svn-id: http://svn.foswiki.org/trunk@15666 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
MichaelDaum authored and MichaelDaum committed Oct 22, 2012
1 parent 5d15d8a commit bdd751a
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions core/lib/Foswiki/UI/View.pm
Expand Up @@ -62,7 +62,8 @@ sub view {
$topicObject->finish();
}

my $cache = $session->{cache};
my $cache = $session->{cache};
my $response = $session->{response};
my $cachedPage;
$cachedPage = $cache->getPage( $web, $topic ) if $cache;
if ($cachedPage) {
Expand All @@ -77,22 +78,24 @@ sub view {
# set status
my $status = $cachedPage->{status};
if ( $status == 302 ) {
$session->{response}->redirect( $cachedPage->{location} );
$response->redirect( $cachedPage->{location} );
}
else {

# See Item9941 to understand why do not set status when 200
$session->{response}->status($status) unless $status eq 200;
$response->status($status) unless $status eq 200;
}

$session->{response}->pushHeader( 'X-Foswiki-PageCache', 1 );
$response->pushHeader( 'X-Foswiki-PageCache', 1 );
$response->pushHeader( 'X-Foswiki-Monitor-renderTime',
$session->{request}->getTime() );

# set headers
$session->generateHTTPHeaders( 'view', $cachedPage->{contenttype},
$text, $cachedPage );

# send it out
$session->{response}->print($text);
$response->print($text);

Monitor::MARK('Wrote HTML');
$session->logger->log(
Expand Down Expand Up @@ -212,7 +215,7 @@ sub view {
$topicObject = Foswiki::Meta->new( $session, $web, $topic );
$indexableView = 0;
$session->enterContext('new_topic');
$session->{response}->status(404);
$response->status(404);
$showRev = 1;
$maxRev = 0;
$viewTemplate = 'TopicDoesNotExistView';
Expand Down

0 comments on commit bdd751a

Please sign in to comment.