meriturva / hangfire.performcontextaccessor Goto Github PK
View Code? Open in Web Editor NEWEasy way to get PerformContext
License: MIT License
Easy way to get PerformContext
License: MIT License
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.
Hello,
I would like to use your package in a .net core 2.2 application (which is supposed to be doable) but you are using a reference which required at least .net core 3.1
The identified issue is with the package Microsoft.Extensions.DependencyInjection.Abstractions version 6+
You can find more information here : dotnet/runtime#63744
For reference, you can find the compatibility matrix here : https://learn.microsoft.com/en-us/dotnet/standard/net-standard?tabs=net-standard-2-0
Could you let me know if you will provide a version compatible with .net core 2.0+ ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.