Skip to content

Commit

Permalink
pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
rtpascual committed Jul 17, 2024
1 parent 0fa4a84 commit 28a6825
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions packages/backend-function/src/schedule_parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,10 @@ export const convertFunctionSchedulesToRuleSchedules = (
const ruleSchedules: Schedule[] = [];

schedules.forEach((schedule) => {
let hasError = false;
if (isTimeInterval(schedule)) {
const { value, unit } = parseTimeInterval(schedule);

if (value && !isPositiveWholeNumber(value)) {
hasError = true;
errors.push(
'Function schedule rate must be set with a positive whole number'
);
Expand All @@ -41,7 +39,6 @@ export const convertFunctionSchedulesToRuleSchedules = (
unit === 'm' &&
value * 60 < lambda.timeout.toSeconds()
) {
hasError = true;
const timeout = lambda.timeout.toSeconds();
errors.push(
`Function schedule rate must be greater than the function timeout of ${timeout} ${
Expand All @@ -53,12 +50,11 @@ export const convertFunctionSchedulesToRuleSchedules = (
const cronErrors = validateCron(schedule);

if (cronErrors.length > 0) {
hasError = true;
errors.push(...cronErrors);
}
}

if (!hasError) {
if (errors.length === 0) {
ruleSchedules.push(Schedule.cron(translateToCronOptions(schedule)));
}
});
Expand Down

0 comments on commit 28a6825

Please sign in to comment.