chrisboulton/php-resque — pull request #81 by ebernhardson (2013-01-13 09:12:29+00:00)
Title: Fastcgi

As discussed previously, this is a refactor of the the current fork/inprocess strategy into independant 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 thats 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 test this code. Its fairly straight forward code, but needs to be tested one way or the other. I'm open to suggestions which i can flush out into proper tests.