fix: no cron time zone on repeat-seconds worker schedules #17

Merged
KofTwentyTwo merged 1 commits from fix/repeat-schedule-time-zone into develop 2026-10-14 20:10:03 +00:00
2 changed files with 21 additions and 1 deletions

No files matched your search

@@ -61,7 +61,11 @@ public class OutboundProcesses implements BackendStep
.withStep(new QBackendStepMetaData().withName("execute").withCode(new QCodeReference(OutboundProcesses.class)));
if(config.getSchedulerName() != null && (seconds != null || cron != null))
{
process.withSchedule(new QScheduleMetaData().withSchedulerName(config.getSchedulerName()).withRepeatSeconds(seconds).withCronExpression(cron).withCronTimeZoneId("UTC"));
//////////////////////////////////////////////////////////////////////////
// core validation refuses a cron time zone on a repeat schedule //
//////////////////////////////////////////////////////////////////////////
process.withSchedule(new QScheduleMetaData().withSchedulerName(config.getSchedulerName()).withRepeatSeconds(seconds).withCronExpression(cron)
.withCronTimeZoneId(cron == null ? null : "UTC"));
}
return (process);
}
@@ -329,4 +329,20 @@ class OutboundTest
{
return (SystemWrites.call(() -> EdiRecords.query(table, new QQueryFilter())));
}
/*******************************************************************************
** Repeat-seconds worker schedules carry no cron time zone (core instance
** validation refuses one on a non-cron schedule); cron schedules use UTC.
*******************************************************************************/
@Test
void repeatSchedulesHaveNoCronTimeZone()
{
com.kingsrook.qbits.edi.EdiQBitConfig config = new com.kingsrook.qbits.edi.EdiQBitConfig().withSchedulerName("scheduler");
var repeat = com.kingsrook.qbits.edi.processes.OutboundProcesses.process("edi_test_repeat", config, 15, null).getSchedule();
assertThat(repeat.getRepeatSeconds()).isEqualTo(15);
assertThat(repeat.getCronTimeZoneId()).isNull();
var cron = com.kingsrook.qbits.edi.processes.OutboundProcesses.process("edi_test_cron", config, null, "0 0 * * * ?").getSchedule();
assertThat(cron.getCronTimeZoneId()).isEqualTo("UTC");
}
}