# Setting job expiration for Redis job storage doesn't work properly

**URL:** <https://discuss.hangfire.io/t/setting-job-expiration-for-redis-job-storage-doesnt-work-properly/11110>\
**Category:** bug?\
**Tags:** redis, hangfire-pro, queues, aspnetcore\
**Created:** [January 8, 2025, 11:00am UTC](https://discuss.hangfire.io/t/setting-job-expiration-for-redis-job-storage-doesnt-work-properly/11110 "2025-01-08T11:00:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sncf-pedro-de-rycker](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/sncf-pedro-de-rycker/32/3904_2.png) [@sncf-pedro-de-rycker](https://discuss.hangfire.io/u/sncf-pedro-de-rycker)\
**Post date:** [January 8, 2025, 11:00am UTC](https://discuss.hangfire.io/t/setting-job-expiration-for-redis-job-storage-doesnt-work-properly/11110/1 "2025-01-08T11:00:26Z")

</div>

It looks like when I set the job expiration through filters or with “WithJobExpirationTimeout”, it only works on the default queue, not on the other ones who are setted to the default 7 days.

---

<div class="post-metadata">

**Author:** ![odinserj](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/odinserj/32/648_2.png) [@odinserj](https://discuss.hangfire.io/u/odinserj)\
**Post date:** [January 9, 2025, 9:23am UTC](https://discuss.hangfire.io/t/setting-job-expiration-for-redis-job-storage-doesnt-work-properly/11110/2 "2025-01-09T09:23:29Z")

</div>

7-days expiration override is likely related to batches and their jobs. Please try specifying a custom expiration time for them when calling the `UseBatches` method:

```csharp
    .UseBatches(TimeSpan.FromHours(24))

```

---

<div class="post-metadata">

**Author:** ![sncf-pedro-de-rycker](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/sncf-pedro-de-rycker/32/3904_2.png) [@sncf-pedro-de-rycker](https://discuss.hangfire.io/u/sncf-pedro-de-rycker)\
**Post date:** [January 10, 2025, 9:43am UTC](https://discuss.hangfire.io/t/setting-job-expiration-for-redis-job-storage-doesnt-work-properly/11110/3 "2025-01-10T09:43:35Z")

</div>

It was due to batching and your parameter solved it. Thank you :-).
