Perl Script slow over tom cat 6.0 and generates service time out

I am running a perl script on tom cat 6.0 server over windows 2008 R2 to pull from repository. The script becomes very slow because it has to wait for the git pull to complete. This creates a service time out for Github webhook which is actually triggering the script. There is nothing in the code except the following line.

exec("C:\\Git\\bin\\git.exe pull") ;

How can I improve the script so that the webhook starts working. The following is the error I get at the github webhook.

We couldn’t deliver this payload: Service Timeout

When I run the script in browser it takes roughly 50s to more than 1 minute. Probably the tom cat is overloaded?

—- Update after using fork —–
I used the following code to implement it via fork. It works locally (when executed on command line) but when I run via web server I get a positive signal to webhook but the changes are not committed meaning the server_script did not run.

$pid = fork();
if( $pid == 0 ){
   exec("perl server_script.pl");
   print "This is child process\n";
   print "Child process is existing\n";
   exit 0;
}
print "This is parent process and child ID is $pid\n";
print "Parent process is existing\n";
exit 0;

  • Is it possible to reject a commit on Github if the commit isn't formatted correctly?
  • Jenkins build only one branch that has been pushed
  • Setting up git web hook to point to jekyll-hook on nginx? What should be the payload URL?
  • automatically sync local git repository with remote repository when there is a new commit on the same branch
  • How to add unique integer short ID (feature number) for every card in trello?
  • Deploy Github release to Node server with webhooks
  • Sync the local code to Amazon server through GitHub webhook
  • Github-plugin for Jenkins get committer and author name
  • One Solution collect form web for “Perl Script slow over tom cat 6.0 and generates service time out”

    It should be possible to decouple the two operations:

    • listening to the webhook payload
    • launching the git pull

    The first listener should simply raise a flag (like for instance touch a file), in order to signal the reception of the webhook.

    The second process should monitor that flag, and if said flag is raised, launch the git pull.

    By decoupling the two operations, by making them asynchronous, you allow the webhook to always complete.

    Git Baby is a git and github fan, let's start git clone.