BAEL-8820: DB-Scheduler - Persistent cluster-friendly scheduler for Java - #19295
Conversation
| create table scheduled_tasks ( | ||
| task_name varchar(100), | ||
| task_instance varchar(100), | ||
| task_data blob, | ||
| execution_time TIMESTAMP WITH TIME ZONE, | ||
| picked BIT, | ||
| picked_by varchar(50), | ||
| last_success TIMESTAMP WITH TIME ZONE, | ||
| last_failure TIMESTAMP WITH TIME ZONE, | ||
| consecutive_failures INT, | ||
| last_heartbeat TIMESTAMP WITH TIME ZONE, | ||
| version BIGINT, | ||
| priority SMALLINT, | ||
| PRIMARY KEY (task_name, task_instance) | ||
| ) No newline at end of file |
There was a problem hiding this comment.
Let's fix the formatting here
There was a problem hiding this comment.
This was directly copied from the db-scheduler files, formatting and all. I can update it if you want though?
There was a problem hiding this comment.
Yes please, we should follow the Baeldung formatting style for PRs
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
|
|
||
| public class DbSchedulerLiveTest { |
There was a problem hiding this comment.
JUnit 5 test classes are package-private per the repo conventions, so let's drop the public
| // Just block forever | ||
| Thread.currentThread().join(); |
There was a problem hiding this comment.
These join() tests block forever here, so they never complete or assert anything, even when run deliberately. Let's use a CountDownLatch (or Awaitility) in the execute handler, await with a timeout, assert the task actually ran, then scheduler.stop(). Same for the one-time and dynamic recurring tests below.
| } | ||
|
|
||
| @Test | ||
| void whenStartingARecurringTask_theTaskRunsRegularly() throws Exception { |
There was a problem hiding this comment.
| void whenStartingARecurringTask_theTaskRunsRegularly() throws Exception { | |
| void whenStartingARecurringTask_thenTheTaskRunsRegularly() throws Exception { |
whenXxx_thenXxxx
Same below
No description provided.