Skip to content

Commit 9a856f3

Browse files
authored
Send unset catchupWindow in schedules if not specified (#2067)
If the catchupWindow property was not set in SchedulePolicy, it was sent as a zero duration in the appropriate protobuf message. However, the server expects an unset value here. The previous behavior led to setting the actual catchupWindow on the server to the minimal value (10 seconds) instead of the default (1 year).
1 parent 9cdff7a commit 9a856f3

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

temporal-sdk/src/main/java/io/temporal/internal/client/ScheduleProtoUtil.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,13 @@ public ScheduleAction actionToProto(io.temporal.client.schedules.ScheduleAction
161161
}
162162

163163
public SchedulePolicies policyToProto(SchedulePolicy policy) {
164-
return SchedulePolicies.newBuilder()
165-
.setCatchupWindow(ProtobufTimeUtils.toProtoDuration(policy.getCatchupWindow()))
166-
.setPauseOnFailure(policy.isPauseOnFailure())
167-
.setOverlapPolicy(policy.getOverlap())
168-
.build();
164+
SchedulePolicies.Builder builder = SchedulePolicies.newBuilder();
165+
if (policy.getCatchupWindow() != null) {
166+
builder.setCatchupWindow(ProtobufTimeUtils.toProtoDuration(policy.getCatchupWindow()));
167+
}
168+
builder.setPauseOnFailure(policy.isPauseOnFailure());
169+
builder.setOverlapPolicy(policy.getOverlap());
170+
return builder.build();
169171
}
170172

171173
public List<Range> scheduleRangeToProto(List<ScheduleRange> scheduleRanges) {

0 commit comments

Comments
 (0)