I have scheduled a Job via using Hangfire library. My scheduled Code like below.
BackgroundJob.Schedule(() => MyRepository.SomeMethod(2),TimeSpan.FromDays(7));
public static bool DownGradeUserPlan(int userId)
{
//Write logic here
}
Now I want to Delete this Scheduled Job later on some event.
Starting from Mar 8, 2022 Hangfire is owned by Hangfire OÜ (private limited), an Estonian company.
Hangfire is an open-source framework that can be used to perform background processing in . Net and . Net Core applications. It is mainly used to perform background tasks such as batch/email notification, batch import of files, video/image processing, database maintaining, file purging, etc.
BackgroundJob.Schedule
returns you an id of that job, you can use it to delete this job:
var jobId = BackgroundJob.Schedule(() => MyRepository.SomeMethod(2),TimeSpan.FromDays(7));
BackgroundJob.Delete(jobId);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With