php-resque
php-resque copied to clipboard
Keeping track of Process status as well as result
- if the "Perform()" function returns result, store it along with process status
- return process status+result in Resque_Job_Status->get()
- allow user to delete the status from redis
- allow user to query result of the job
Sorry for the delay - meant to chime in sooner.
Upon further research, I discovered that part of my previous advice (in PR #132) was incorrect - specifically, this change doesn't affect the Resque Web interface one whit. Apparently, job status (as well as job stats, though that's another story altogether) isn't one of the things Ruby Resque tracks. So that argument against accepting and merging this PR is invalid.
In fact, this kind of functionality is actually available in Ruby Resque 1.8 via the resque-result plugin. So there's precedent for accepting this kind of modification into the project. Especially since PHP-Resque doesn't encourage plugins in the same way the Ruby version does - though it supports them, since it provides the same (or at least a very similar) hook system.
Ultimately? One of my projects handles all of this by having a parent class for all jobs that stores results in Redis as part of the tearDown()
method. This is a more robust solution for what I am doing because I need a lot more data about the job itself when I go to process its results, but by no means is it the right solution, especially in cases less highly specialized than mine. So this sounds like a really useful feature to me. It allows developers to write their perform()
methods using the standard PHP approach of return
ing output to the calling function, rather than storing it someplace for later retrieval by a different method. So essentially, :+1:!
Looks ok :+1: