Sample Header Ad - 728x90

How to deal with 'failed' pg_cron jobs (postgres)

1 vote
1 answer
2816 views
I have some Jobs (postgres plpgsql procedures) that I am scheduling using pg_cron library/extension and cron expressions. I have some scripts that have failed and thus logged the 'failed' status column in the cron.job_run_details table. The problem is that the Job will try to re-try, even though there it will fail again, which causes necessary load on my DB. My main database tables are of course on a different database than the default **postgres** db that pg_cron uses, thus, I cannot query the cron.job_run_details table (cross db). I wanted to probably query this table is an entry for my job name existed with a 'failed' status. What is the best way to deal with these failures? Since the whole point of pg_cron is to automate, I need a way to have these scripts running and if they fail, to somehow resolve themselves without manual intervention.
Asked by PainIsAMaster (131 rep)
Oct 5, 2021, 02:41 PM
Last activity: Oct 20, 2021, 12:00 PM