As discussed in issue #76 this is a refactor of the the current fork/in-process strategy into independent objects along with the addition of a fastcgi strategy to utilize php-fpm.
A couple notes:
To pass the job between the worker and fastcgi I settled on serializing the job and passing as an environment variable. Specifically when failing a job both the worker and job instances are required. I thought it best to serialize and pass both rather than make changes to the failure code.
I pulled the FCGIClient into the repository, currently under the BitTP namespace as that is where i found it. I had to make a few changes to this class to make it fit our usage; Specifically it was originally written using non-blocking sockets and busy-waiting to read the socket. For our purposes a blocking fastcgi client is more appropriate so i made that change. It may be more appropriate to re-namespace or put into a repo on its own to be referenced by composer.
I could not come up with a good way to programmatically test this code. Its fairly straight forward code, and I've run numerous tests by hand, but needs automated on-going testing one way or the other. I'm open to suggestions which i can flush out into proper tests.
This looks good 👍.
Before I bring it in, I want to work on externalizing the FCGIClient (essentially creating a Composer package for it), and obviously work on the testing. If you don't have the time to do this, I'll probably begin work on getting this down sometime in the next two weeks.
Refactor forking code into Resque_JobStrategy_Interface
Import FCGIClient by Preetam Jinka
Removing namespacing for 5.2+ compatibility
convert fcgi to exceptions and blocking sockets
seperate fcgi response from error output
calculate status code for fcgi responses
Fastcgi job strategy implementation
The FastCGI client has been extracted into a suggested package, https://github.com/ebernhardson/fastcgi , and the pull request has been updated.
Still need to figure out a full featured way to test the JobStrategy interactions.
move fastcgi client to external composer package
Sorry, I meant to spend some time on this but dropped the ball because I've been busy with work and life at the moment. I definitely appreciate the effort you're putting into this.
refactoring to JobStrategy, adding FastCGI option, fixing unit test i…
Merging changes from chrisboulton#81
what is the status on this PR ? is help needed ?