[Improve](Job)Job internal interface provides immediate scheduling (#23735)

Delete meaningless job status
System scheduling is executed in the time wheel
Optimize window calculation code
This commit is contained in:
Calvin Kirs
2023-09-01 12:50:08 +08:00
committed by GitHub
parent c31cb5fd11
commit e88c218390
8 changed files with 51 additions and 104 deletions

View File

@ -132,6 +132,18 @@ public class TimerJobManagerTest {
Assertions.assertEquals(2, testExecuteCount.get());
}
@Test
public void testCycleSchedulerWithImmediatelyStart(@Mocked Env env) throws DdlException {
setContext(env);
long startTimestamp = System.currentTimeMillis();
job.setImmediatelyStart(true);
timerJobManager.registerJob(job);
//consider the time of the first execution and give some buffer time
Awaitility.await().atMost(16, TimeUnit.SECONDS).until(() -> System.currentTimeMillis()
>= startTimestamp + 15000L);
Assertions.assertEquals(3, testExecuteCount.get());
}
@Test
public void testOneTimeJob(@Mocked Env env) throws DdlException {
setContext(env);