16 lines
494 B
C#
16 lines
494 B
C#
using Hangfire.Common;
|
|
using Hangfire.States;
|
|
|
|
namespace Strata.Stratasphere.Biz.Configuration.Hangfire
|
|
{
|
|
public class DeleteOnSuccessAttribute : JobFilterAttribute, IElectStateFilter
|
|
{
|
|
public void OnStateElection(ElectStateContext context)
|
|
{
|
|
if (context.CandidateState.Name == SucceededState.StateName)
|
|
{
|
|
context.CandidateState = new DeletedState { Reason = "This job is deleted on success." };
|
|
}
|
|
}
|
|
}
|
|
} |