{"thread":{"id":"24294","subject":"[PATCH] gitweb: Move evaluate_gitweb_config out of run_request","startedAt":"2010-07-05T18:52:43Z","lastAt":"2010-07-05T18:52:43Z","messageCount":1,"participants":["Jakub Narebski"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"144839","messageId":"20100705185136.30020.97751.stgit@localhost.localdomain","threadId":"24294","inReplyTo":null,"subject":"[PATCH] gitweb: Move evaluate_gitweb_config out of run_request","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-07-05T18:52:43Z","receivedAt":"2010-07-05T18:52:43Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Move evaluate_gitweb_config() and evaluate_git_version() out of\nrun_request() to run(), making them not run one for each request.  \nThis changes how git behaves in FastCGI case.\n\nThis change makes it impossible to have config which changes with\nrequest, but I don't think anyone relied on such (hidden action)\nbehavior.\n\nWhile at it, reset timer and number of git commands at beginning of\nrun_request() in new reset_timer() subroutine.  This fixes case when\ngitweb was run using FastCGI interface: time is reported for request,\nand not for single run of gitweb script.  This changes slightly\nbehavior in non-FastCGI case: the number of git commands reported is\n1 less (running `git --version` one per gitweb is not counted now).\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\nIt joins bugfix (for FastCGI case) with improvements (probably better\nperformance for FastCGI case)\n\n gitweb/gitweb.perl |   17 +++++++++++------\n 1 files changed, 11 insertions(+), 6 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 9446376..1f611d2 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -1027,18 +1027,18 @@ sub dispatch {\n \t$actions{$action}->();\n }\n \n-sub run_request {\n+sub reset_timer {\n \tour $t0 = [Time::HiRes::gettimeofday()]\n \t\tif defined $t0;\n+\tour $number_of_git_cmds = 0;\n+}\n+\n+sub run_request {\n+\treset_timer();\n \n \tevaluate_uri();\n-\tevaluate_gitweb_config();\n-\tevaluate_git_version();\n \tcheck_loadavg();\n \n-\t# $projectroot and $projects_list might be set in gitweb config file\n-\t$projects_list ||= $projectroot;\n-\n \tevaluate_query_params();\n \tevaluate_path_info();\n \tevaluate_and_validate_params();\n@@ -1086,6 +1086,11 @@ sub evaluate_argv {\n \n sub run {\n \tevaluate_argv();\n+\tevaluate_gitweb_config();\n+\tevaluate_git_version();\n+\n+\t# $projectroot and $projects_list might be set in gitweb config file\n+\t$projects_list ||= $projectroot;\n \n \t$pre_listen_hook->()\n \t\tif $pre_listen_hook;\n"}]}