Skip to content

Commit e5d7dbe

Browse files
authored
Document server-default schedule catchup window (#2950)
1 parent 8fd8cc3 commit e5d7dbe

3 files changed

Lines changed: 31 additions & 2 deletions

File tree

temporal-sdk/src/main/java/io/temporal/client/schedules/SchedulePolicy.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ public Builder setOverlap(ScheduleOverlapPolicy overlap) {
3838

3939
/**
4040
* Set the amount of time in the past to execute missed actions after a Temporal server is
41-
* unavailable.
41+
* unavailable. If unset, the request omits this value and the Temporal Server applies its
42+
* default (currently one year).
4243
*/
4344
public Builder setCatchupWindow(Duration catchupWindow) {
4445
this.catchupWindow = catchupWindow;
@@ -81,7 +82,8 @@ public ScheduleOverlapPolicy getOverlap() {
8182

8283
/**
8384
* Gets the amount of time in the past to execute missed actions after a Temporal server is
84-
* unavailable.
85+
* unavailable. A {@code null} value is omitted from requests so the Temporal Server applies its
86+
* default (currently one year).
8587
*
8688
* @return the schedules catchup window
8789
*/

temporal-sdk/src/test/java/io/temporal/client/schedules/ScheduleTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ public void createSchedule() {
9090
ScheduleHandle handle = client.createSchedule(scheduleId, schedule, options);
9191
ScheduleDescription description = handle.describe();
9292
Assert.assertEquals(scheduleId, description.getId());
93+
Assert.assertEquals(
94+
Duration.ofDays(365), description.getSchedule().getPolicy().getCatchupWindow());
9395
// Verify the schedule description has the correct (i.e. no) memo
9496
Assert.assertNull(description.getMemo("memokey1", String.class));
9597
// Try to create a schedule that already exists
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package io.temporal.internal.client;
2+
3+
import io.temporal.client.schedules.SchedulePolicy;
4+
import java.time.Duration;
5+
import org.junit.Assert;
6+
import org.junit.Test;
7+
8+
public class ScheduleProtoUtilTest {
9+
private final ScheduleProtoUtil util = new ScheduleProtoUtil(null, null);
10+
11+
@Test
12+
public void policyToProtoOmitsDefaultCatchupWindow() {
13+
Assert.assertFalse(util.policyToProto(SchedulePolicy.newBuilder().build()).hasCatchupWindow());
14+
}
15+
16+
@Test
17+
public void policyToProtoIncludesExplicitCatchupWindow() {
18+
Assert.assertEquals(
19+
300L,
20+
util.policyToProto(
21+
SchedulePolicy.newBuilder().setCatchupWindow(Duration.ofMinutes(5)).build())
22+
.getCatchupWindow()
23+
.getSeconds());
24+
}
25+
}

0 commit comments

Comments
 (0)