Skip to content

Commit 19f7e8b

Browse files
authored
Scheduled.ignoreMissed -> automaticBackfill (#364)
Align name of automaticBackfill parameter for dynamic and annotated scheduled workflows fixed #361
1 parent 0234aba commit 19f7e8b

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

transact/src/main/java/dev/dbos/transact/execution/SchedulerService.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class SchedulerService implements AutoCloseable {
3939
private static final Logger logger = LoggerFactory.getLogger(SchedulerService.class);
4040

4141
record AnnotatedScheduledWorkflow(
42-
RegisteredWorkflow workflow, Cron cron, String queue, boolean ignoreMissed) {}
42+
RegisteredWorkflow workflow, Cron cron, String queue, boolean automaticBackfill) {}
4343

4444
public static final CronParser CRON_PARSER =
4545
new CronParser(CronDefinitionBuilder.instanceDefinitionFor(CronType.SPRING53));
@@ -374,7 +374,7 @@ private void cancelWorkflowSchedule(String scheduleId) {
374374

375375
private static ZonedDateTime getLastTime(
376376
DBOSExecutor dbosExecutor, AnnotatedScheduledWorkflow swf) {
377-
if (!swf.ignoreMissed()) {
377+
if (swf.automaticBackfill()) {
378378
var state =
379379
dbosExecutor.getExternalState(
380380
"DBOS.SchedulerService", swf.workflow().fullyQualifiedName(), "lastTime");
@@ -387,7 +387,7 @@ private static ZonedDateTime getLastTime(
387387

388388
private static ZonedDateTime setLastTime(
389389
DBOSExecutor dbosExecutor, AnnotatedScheduledWorkflow swf, ZonedDateTime lastTime) {
390-
if (swf.ignoreMissed()) {
390+
if (!swf.automaticBackfill()) {
391391
return ZonedDateTime.now();
392392
}
393393

@@ -433,7 +433,8 @@ private List<AnnotatedScheduledWorkflow> getAnnotatedWorkflowSchedules() {
433433

434434
try {
435435
var cron = CRON_PARSER.parse(schedTag.cron()).validate();
436-
return new AnnotatedScheduledWorkflow(wf, cron, queueName, schedTag.ignoreMissed());
436+
return new AnnotatedScheduledWorkflow(
437+
wf, cron, queueName, schedTag.automaticBackfill());
437438
} catch (Exception e) {
438439
logger.error(
439440
"Annotated workflow schedule {} has invalid cron expression {}",

transact/src/main/java/dev/dbos/transact/workflow/Scheduled.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212

1313
String queue() default "";
1414

15-
boolean ignoreMissed() default true;
15+
boolean automaticBackfill() default false;
1616
}

transact/src/test/java/dev/dbos/transact/scheduled/AnnotatedScheduledService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public void withSteps(Instant scheduled, Instant actual) {
8484

8585
@Override
8686
@Workflow
87-
@Scheduled(cron = "0/1 * * * * *", ignoreMissed = true)
87+
@Scheduled(cron = "0/1 * * * * *", automaticBackfill = false)
8888
public void everySecondIgnoreMissed(Instant scheduled, Instant actual) {
8989
if (everySecondCounterIgnoreMissed++ == 0) {
9090
try {
@@ -98,7 +98,7 @@ public void everySecondIgnoreMissed(Instant scheduled, Instant actual) {
9898

9999
@Override
100100
@Workflow
101-
@Scheduled(cron = "0/1 * * * * *", ignoreMissed = false)
101+
@Scheduled(cron = "0/1 * * * * *", automaticBackfill = true)
102102
public void everySecondDontIgnoreMissed(Instant scheduled, Instant actual) {
103103
if (everySecondCounterDontIgnoreMissed++ == 0) {
104104
try {

0 commit comments

Comments
 (0)