HangfireIO / HangfireIO/Hangfire
Dashboard Requires Job Code to Be Deployed
- Dominant language
- C#
- Stars
- 10.1k
- Forks
- 1.8k
- Avg merge
- 1h 19m
- Merged PRs (30d)
- 1
Description
We'd like to have a single lightweight Hangfire Dashboard to monitor all of our Hangfire instances across multiple tenants. Unfortunately, in order to display, e.g. a succeeded recurring job, we would also have to deploy the assembly which contains the job's source code or else we see an error message for each job stating "Can not find the target method". I believe this is an unnecessary restriction.
It looks like the problem lies around the `SqlServerMonitoringApi` code: The `SucceededJobDto` class has a `Job` member, and in deserializing the `Job` it tries to find the method to invoke via reflection in order to get the `[DisplayAttribute]` etc. Instead, I think displaying the list of completed jobs should only be dependent on the data stored in the database instead of deserializing the same `Job` class that we use to run a job (i.e. Single Responsibility Principle). This makes deploying the dashboard separately a lot cleaner.
I also think this is more "correct" since we should display the info for the job _as it was at the time the job was run_. I know that #199 addresses this issue in part (although it hasn't been merged yet), but I think this proposed solution is a little stronger in that it will display more helpful information and will more accurately reflect what was actually run, unaffected by any future changes to the code base.
Hopefully this will also allow jobs to be requeued without requiring the job code to be deployed with the dashboard.
I'm willing to submit a PR for this with @odinserj's blessing.
Contributor guide
Assessment
This issue has not been assessed yet.