Global setting for job history

Is there a way to set globally to only keep job history for N time period. We have issues with hangfire ballooning our redis instance as we run a batch job every minute and after a few days that’s a tonne of history. We don’t want to attribute this job by job, but set it for everything.

We’re still having issues with this, we set a one hour expiration but our batch jobs are still sitting there for days. We attributed the class the job is in with:

public class OneHourExpirationTimeAttribute : JobFilterAttribute, IApplyStateFilter
    {
        public void OnStateUnapplied(ApplyStateContext context, IWriteOnlyTransaction transaction)
        {
            context.JobExpirationTimeout = TimeSpan.FromHours(1);
        }

        public void OnStateApplied(ApplyStateContext context, IWriteOnlyTransaction transaction)
        {
            context.JobExpirationTimeout = TimeSpan.FromHours(1);
        }
    }

The job is still sitting there a day later

@tracstarr, batched jobs are overriding their expiration time to follow the expiration settings of the batch itself. To configure the batch expiration time, pass the corresponding TimeSpan when calling the UseBatches method during the configuration:

GlobalConfiguration.Configuration
    .UseXXX()
    .UseBatches(expirationTime: TimeSpan.FromHours(1));