Using HangfirePro 2.0.1, I am unable to get a blank batch job to execute any of its AwaitBatch jobs:
public class HangfireTest
{
public void DemoBatchWeirdness()
{
var emptyBatch = BatchJob.StartNew(action =>
{
//action.Enqueue(() => NOOP());
});
BatchJob.AwaitBatch(emptyBatch,
action =>
{
action.Enqueue<HangfireTest>(x => x.DemoBatchWeirdness2());
});
}
public void NOOP() { }
public void DemoBatchWeirdness2()
{
Debugger.Break();
}
}
If I uncomment action.Enqueue(() => NOOP());
, the debugger will stop within DemoBatchWeirness2(), otherwise it won’t. Method 2 won’t even show up in the hangfire dashboard.
I am calling the first method by injecting in a IBackgroundJobClient into my controller and calling _client.Enqueue<HangfireTest>(x => x.DemoBatchWeirdness());
Am I doing something wrong here, or is this just a bug?