Perl Script is slower than cat cat 6.0 and generates maintenance time

I am running a perl script on a tom cat 6.0 server on top of Windows 2008 R2 to pull from the repository. The script becomes very slow because it has to wait for git to complete. This creates a maintenance time for the Github website, which actually runs the script. There is nothing in the code except the next 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 am getting on the github website.

We were unable to deliver this payload: Service timeout

When I run the script in the browser, it takes about 50 seconds over 1 minute. Is the cat cat overloaded?

---- Update after using fork ----- I used the following code to implement it through fork. It works locally (when executed on the command line), but when I launch through the web server, I get a positive signal to the webhook, but the changes are not executed, which means that server_script did not start.

 $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; 
+1
source share
1 answer

It is necessary to separate two operations:

  • listening webhook payload
  • launch git pull

The first listener should simply raise a flag (for example, touch a file) to signal the reception of a webcam.

The second process should control this flag, and if the flag is set, run git pull .

By decoupling the two operations, making them asynchronous, you let the webhook always populate.

0
source

Source: https://habr.com/ru/post/975923/


All Articles