Hi There,
I have added hangfire netcore packages for scheduling tasks in my asp.net core app. I have given package names and versions below,
"Hangfire.AspNetCore": "1.6.17"
"Hangfire.PostgreSql": "1.4.8.1"
My app is hosted multiple server but hangfire postgres database is sharing by all my apps. I am getting this below issue in my logs files always. I don’t have any idea and please help me to solve this issue.
ERROR:
sql_error_code = 23505 ERROR: duplicate key value violates unique constraint “lock_resource_key”
sql_error_code = 23505 DETAIL: Key (resource)=(HangFire:recurring-jobs:lock) already exists.
sql_error_code = 23505 STATEMENT:
INSERT INTO “hangfire”.“lock”(“resource”, “acquired”)
SELECT $1, $2
WHERE NOT EXISTS (
SELECT 1 FROM “hangfire”.“lock”
WHERE “resource” = $1
)