HangfireIO / Hangfire

An easy way to perform background job processing in .NET and .NET Core applications. No Windows Service or separate process required
https://www.hangfire.io
Other
9.32k stars 1.69k forks source link

Hangfire auto clean up? #2030

Open jwilburn opened 2 years ago

jwilburn commented 2 years ago

Does Hangfire have any functionality to reset its tables and or clean them up? Hangfire.State can grow very large in size over time. I would like to avoid having to write separate code to handle this.

Here is a stackoverflow article describing a similar situation. https://stackoverflow.com/questions/39973447/how-can-i-safely-reset-hangfire-to-a-clean-state

odinserj commented 2 years ago

Sometimes it depends on the storage implementation, and problems with job storage implementation might cause this problem to happen. Could you tell me what storage you are using? Also, it's expected that background job will be finished eventually, and not be retried over and over again, and this behavior might cause Hangfire.State table to grow infinitely.

luizfbicalho commented 2 years ago

I changed my jobs to create a new one instead of requeuing the old one, but it's bad to handle the continuation of a job, if there was a way to make the new job connected to the old one would be easier to control.

in the other hand I have problems with extensions that doesn't clean their data after the job is done

2028

1976