citusdata/pg_cron

connection failed with schedule_in_database

erichanson opened this issue · 1 comments

I've used schedule_in_database() to schedule a job. My job looks like this:

 jobid | schedule  |            command             | nodename  | nodeport | database | username | active |        jobname        
-------+-----------+--------------------------------+-----------+----------+----------+----------+--------+-----------------------
     1 | * * * * * | select feedlot.update_caches() | localhost |     5432 | feedlot  | postgres | t      | feedlot_update_caches
(1 row)

However, the jobs always fail with a return_message of "connection failed":

postgres=# table job_run_details;
 jobid | runid | job_pid | database | username |            command             | status |  return_message   | start_time | end_time                         
-------+-------+---------+----------+----------+--------------------------------+--------+-------------------+------------+----------                        
     1 |  2844 |         | feedlot  | postgres | select feedlot.update_caches() | failed | connection failed |            |                                  
     1 |  2845 |         | feedlot  | postgres | select feedlot.update_caches() | failed | connection failed |            |                                  

I don't know what I am doing wrong or how to debug it. Logs just say the same thing:

2024-01-08 17:06:00.002 UTC [11328] LOG:  cron job 1 starting: select feedlot.update_caches()
2024-01-08 17:06:00.009 UTC [11328] LOG:  cron job 1 connection failed

The postgres user is of course a superuser and has access to everything. Any ideas?

I think this section of the readme will help