@@ -65,7 +65,10 @@ SELECT pg_reload_conf();
6565SELECT scheduled FROM alter_job(:job_id_1, next_start => now());
6666SELECT scheduled FROM alter_job(:job_id_2, next_start => now());
6767
68- SELECT _timescaledb_functions .restart_background_workers ();
68+ -- Wake the scheduler so it picks up the new next_start without killing
69+ -- any in-flight worker (a hard restart races with running jobs and can
70+ -- leave an unclosed history row that surfaces as "crash detected").
71+ SELECT pg_reload_conf();
6972SELECT test .wait_for_job_to_run (:job_id_1, 2 );
7073SELECT test .wait_for_job_to_run (:job_id_2, 2 );
7174
@@ -85,7 +88,7 @@ SELECT scheduled FROM alter_job(:job_id_2, config => '{"bar": 1}'::jsonb);
8588SELECT scheduled FROM alter_job(:job_id_1, next_start => now());
8689SELECT scheduled FROM alter_job(:job_id_2, next_start => now());
8790
88- SELECT _timescaledb_functions . restart_background_workers ();
91+ SELECT pg_reload_conf ();
8992SELECT test .wait_for_job_to_run (:job_id_1, 3 );
9093SELECT test .wait_for_job_to_run (:job_id_2, 3 );
9194
@@ -98,7 +101,7 @@ ORDER BY id, job_id;
98101-- Changing the config of one job
99102SELECT scheduled FROM alter_job(:job_id_1, config => ' {"foo": 2, "bar": 1}' ::jsonb);
100103SELECT scheduled FROM alter_job(:job_id_1, next_start => now());
101- SELECT _timescaledb_functions . restart_background_workers ();
104+ SELECT pg_reload_conf ();
102105SELECT test .wait_for_job_to_run (:job_id_1, 4 );
103106
104107-- Check job execution history
118121
119122-- Run the job
120123SELECT scheduled FROM alter_job(:job_id_1, next_start => now());
121- SELECT _timescaledb_functions . restart_background_workers ();
124+ SELECT pg_reload_conf ();
122125SELECT test .wait_for_job_to_run (:job_id_1, 5 );
123126
124127-- Check job execution history
141144
142145-- Run the job
143146SELECT scheduled FROM alter_job(:job_id_1, next_start => now());
144- SELECT _timescaledb_functions . restart_background_workers ();
147+ SELECT pg_reload_conf ();
145148SELECT test .wait_for_job_to_run (:job_id_1, 6 );
146149
147150-- Check job execution history
@@ -159,12 +162,12 @@ END
159162$$;
160163
161164SELECT add_job(' custom_job_alter' , schedule_interval => interval ' 1 hour' , initial_start := now()) AS job_id_3 \gset
162- SELECT _timescaledb_functions . restart_background_workers ();
165+ SELECT pg_reload_conf ();
163166SELECT test .wait_for_job_to_run (:job_id_3, 1 );
164167
165168SELECT timezone, fixed_schedule, config, schedule_interval
166169FROM alter_job(:job_id_3, timezone => ' America/Sao_Paulo' , fixed_schedule => false, config => ' {"key": "value"}' ::jsonb, schedule_interval => interval ' 10 min' , next_start => now());
167- SELECT _timescaledb_functions . restart_background_workers ();
170+ SELECT pg_reload_conf ();
168171SELECT test .wait_for_job_to_run (:job_id_3, 2 );
169172
170173-- Should return two executions, the second will show the changed values
0 commit comments