Skip to content

Commit f8992bc

Browse files
committed
Put off opening the log file until it's needed
1 parent 56625b4 commit f8992bc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cgi-bin/page.fcgi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,6 @@ sub doit
267267
my %params = (ref($_[0]) eq 'HASH') ? %{$_[0]} : @_;
268268

269269
$config ||= VWF::Config->new({ logger => $logger, info => $info, debug => $params{'debug'} });
270-
$vwflog ||= $config->vwflog() || File::Spec->catfile($info->logdir(), 'vwf.log');
271270
$info_cache ||= create_memory_cache(config => $config, logger => $logger, namespace => 'CGI::Info');
272271

273272
my $options = {
@@ -305,6 +304,8 @@ sub doit
305304
# Check and increment request count
306305
my $request_count = $rate_limit_cache->get($client_ip) || 0;
307306

307+
$vwflog ||= $config->vwflog() || File::Spec->catfile($info->logdir(), 'vwf.log');
308+
308309
# Rate limit by IP
309310
unless(grep { $_ eq $client_ip } @rate_limit_trusted_ips) { # Bypass rate limiting
310311
if($request_count >= $MAX_REQUESTS) {

0 commit comments

Comments
 (0)