Hangfire
Hangfire copied to clipboard
Feature Request: Add custom sql queries to ExpirationManager
It would be nice to add custom queries to ExpirationManager, this way when an extensions is installed, it can control the correct clean of their data
For example I need to add this to clean my data.
declare @total int = 0
declare @count int = 1
while(@count>0)
begin
update
[HangFire].[Set] set ExpireAt = GETDATE() where [key] in (
SELECT top 10000 [key]
FROM [HangFire].[Set]
left join hangfire.job on job.Id = SUBSTRING([Key], 19, LEN([Key]) - 19)
WHERE [Key] LIKE 'console:%'
and job.id is null
and [HangFire].[Set].ExpireAt is null
)
set @count = @@ROWCOUNT
set @total = @total + @count
print @total
end
Another alternative is to put the JobId in the set database and then expire the data with the end of the job