What do you think about storing the return value of jobs? I mean, when Hangfire finishes a job, it should store the returned value and then show it in the dashboard along other information about the successful run (latency, duration, etc.)
The result could be something like “Processed 1024 items”.
I have spent only few minutes looking into the source code but I would do it this way:
- Update InvokeMethod and Perform in Job.cs to return object instead of void.
- In PerformJobWithFilters in JobPerformanceProcess.cs, store the returned value into PerformedContext.
- Add a new filter that would store the returned value along other information about the job run.
This way, you could easily enable/disable the return value storing or change it any way you want.
I don’t know the architecture of Hangfire as well as you do, so, what do you think?
Would you accept a pull request if this was implemented?
Where would you suggest to store the returned value? To me, State.Data seems to be the best fit.
Edit: I have opened a pull request for this issue https://github.com/HangfireIO/Hangfire/pull/161