thanks for your work on this project.
I’ve been using Hangfire with a custom attribute to dynamically schedule and invoke jobs, and I pass specific parameters to them.
Handler
var x = scope.ServiceProvider.GetRequiredService<IPerformContextAccessor>();
var result = !method.GetParameters().Any(t => t.ParameterType == typeof(PerformContext)) ? (Task?)method.Invoke(obj, new object[] {
tenants }) :
(Task?)method.Invoke(obj, new object?[] { tenants, x.PerformingContext });
And here is the job method that is intended to display progress:
[CustomArrtibute("0 14 * * *")]
public Task ScheduleJob(IEnumerable<long> tenants, PerformContext performContext)
{
var bar = performContext.WriteProgressBar(10);
for (var i = 0; i <= 100; i += 10)
{
bar.SetValue(i);
System.Threading.Thread.Sleep(TimeSpan.FromMilliseconds(200));
}
Console.WriteLine("do " + DateTime.Now);
return Task.CompletedTask;
}
However, the bar.SetValue(i) method does not seem to be functioning as expected. The progress bar does not reflect the current progress state during the job execution.
thanks for your work on this project.
I’ve been using Hangfire with a custom attribute to dynamically schedule and invoke jobs, and I pass specific parameters to them.
Handler
And here is the job method that is intended to display progress:
However, the bar.SetValue(i) method does not seem to be functioning as expected. The progress bar does not reflect the current progress state during the job execution.