Closed robertgm closed 3 years ago
Would also like a fix for this.
@bzumhagen - this method is an override of JobStorageConnection
https://www.github.com/imranmomin/Hangfire.AzureCosmosDb/tree/develop/src%2FCosmosDbConnection.cs
You will need to check how Hangfire itself pass this value.
Or it could be configuration you need to set while setting up the server
When the background job is enqueued, it is given the 30 day expiration. When the job state is changed, it's supposed to get the configured expiration time.
There is a bug in the cosmos stored procedure to update the jobs, which I have an open PR for here:
https://github.com/imranmomin/Hangfire.AzureCosmosDb/pull/23
You can edit the stored procedure through the Cosmos UI as a temporary fix.
Closing this issue as the pull-request was accepted
@imranmomin when do you think you'll release?
@bzumhagen - I released a test package. Can you confirm if it works fine. So I can later merge to master and do a final release
https://www.nuget.org/packages/Hangfire.AzureCosmosDB/1.3.0-develop
dotnet add package Hangfire.AzureCosmosDB --version 1.3.0-develop
@imranmomin I can confirm that the storedProcedure fix works fine.
However the iStorageConnection.GetJobData still throws when the job is missing. This seems to be because of the way you handle the task, the resulting exception is wrapped in a System.AggregateException instead of just being a Microsoft.Azure.Cosmos.CosmosException.
System.AggregateException: One or more errors occurred. (Response status code does not indicate success: NotFound (404); Substatus: 0; ActivityId: b3e897eb-aa5c-4205-af41-0b2999d53605; Reason: (
Errors : [
"Resource Not Found. Learn more: https://aka.ms/cosmosdb-tsg-not-found"
]
);)
---> Microsoft.Azure.Cosmos.CosmosException : Response status code does not indicate success: NotFound (404); Substatus: 0; ActivityId: b3e897eb-aa5c-4205-af41-0b2999d53605; Reason: (
Errors : [
"Resource Not Found. Learn more: https://aka.ms/cosmosdb-tsg-not-found"
]
In CosmosDbConnection we have method to create expire job. Last parameter is expireIn. This parameter is always set as 30 days. There is no way to set custom value, for example 1 day or 7 days: