Skip to content

Commit 98e97ab

Browse files
authored
Merge pull request #131 from killbill/skip-non-recurring-reports
reports: avoid infinite loop of refreshes when frequency isn't set
2 parents a4965f3 + a864f96 commit 98e97ab

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/main/java/org/killbill/billing/plugin/analytics/reports/scheduler/JobsScheduler.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,10 @@ private void schedule(final AnalyticsReportJob eventJson, @Nullable final Connec
210210
}
211211

212212
final DateTime nextRun = computeNextRun(eventJson);
213-
logger.info("Next run for report {} will be at {}", eventJson.getReportName(), nextRun);
214-
schedule(eventJson, nextRun, connection);
213+
if (nextRun != null) {
214+
logger.info("Next run for report {} will be at {}", eventJson.getReportName(), nextRun);
215+
schedule(eventJson, nextRun, connection);
216+
}
215217
}
216218

217219
private void schedule(final AnalyticsReportJob eventJson, final DateTime nextRun, @Nullable final Connection connection) {
@@ -240,8 +242,7 @@ DateTime computeNextRun(final AnalyticsReportJob report) {
240242
final DateTime boundaryTime = now.withHourOfDay(hourOfTheDayGMT).withMinuteOfHour(0).withSecondOfMinute(0).withMillisOfSecond(0);
241243
return now.compareTo(boundaryTime) >= 0 ? boundaryTime.plusDays(1) : boundaryTime;
242244
} else {
243-
// Run now
244-
return now;
245+
return null;
245246
}
246247
}
247248

0 commit comments

Comments
 (0)