From b5584d335480df0bd9248a9c71e2b64200e2a818 Mon Sep 17 00:00:00 2001 From: John 'Warthog9' Hawley Date: Thu, 23 Sep 2010 17:33:26 -0700 Subject: [PATCH] Gitweb - Adding option to disable forking This is here mainly for debugging purposes, or for individuals who are working on a system where they know forking will cause problems. Setting this to 0 will disable forking all together, and attempt to act like a single threaded process, but still have the ability to have caching enabled. --- gitweb/cache.pm | 4 ++-- gitweb/gitweb_defaults.perl | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/gitweb/cache.pm b/gitweb/cache.pm index 4c6bd2c970..c771b02d5b 100755 --- a/gitweb/cache.pm +++ b/gitweb/cache.pm @@ -64,7 +64,7 @@ sub cache_fetch { } # done dealing with cache enabled / disabled if(! -e "$fullhashpath" ){ - if($cache_enable == 0 || ! defined(my $childPid = fork()) ){ + if( ! $cache_enable || ! $cacheDoFork || ! defined(my $childPid = fork()) ){ cacheUpdate($action,0); cacheDisplay($action); } elsif ( $childPid == 0 ){ @@ -87,7 +87,7 @@ sub cache_fetch { $cacheTime = $minCacheTime; } if( (stat(_))[9] < (time - $cacheTime) ){ - if( ! defined(my $childPid = fork()) ){ + if( ! $cacheDoFork || ! defined(my $childPid = fork()) ){ cacheUpdate($action,0); cacheDisplay($action); } elsif ( $childPid == 0 ){ diff --git a/gitweb/gitweb_defaults.perl b/gitweb/gitweb_defaults.perl index f5c075ca89..e3b652c25f 100755 --- a/gitweb/gitweb_defaults.perl +++ b/gitweb/gitweb_defaults.perl @@ -247,6 +247,9 @@ $backgroundCache = 1; # 18000 = 5 hours $maxCacheLife = 18000; +# Used to enable or disable background forking of the gitweb caching. Mainly here for debugging purposes +$cacheDoFork = 1; + # You define site-wide feature defaults here; override them with # $GITWEB_CONFIG as necessary. %feature = ( -- 2.11.4.GIT