What I want to achieve: User uploads a datafile. It is added to queue, and when it's turn comes, it creates number of parallel tasks consisting of converting rows inside that file. Anytime user wants, he can get status (in %), of how much rows were converted.
I decided to go with gearman, as probably in future it'd be good thing to move workers to other servers and stuff. As I understand it, you should avoid using unnecessary connections to database when using workers, so storing the status in database is not a viable option.
I've tried something like this: controller creates new background task (file processing), and this task calls smaller tasks (converting, I used background to achieve parallelism), then uploads final result to database. Gearman event listener works only for non-background tasks (at least in my attempts to attach it).
Should I fetch all tasks and check job parameters to link it to specific id, or can I somehow pass additional parameter to job?
GearmanClient::jobStatus requires job handle, which I don't have access to, as it's background process created in one request, but needed in other one.
Sorry for wall of text, and thanks for your help!