Skip to content

Commit

Permalink
[MOBILE-856] use the end + grace period as finish date sometimes (#618)
Browse files Browse the repository at this point in the history
* [MOBILE-856] use the end + grace period as finish date sometimes

* [MOBILE-856] comment
  • Loading branch information
crow authored Nov 4, 2019
1 parent dcf371c commit 5cbcece
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -918,9 +918,17 @@ private void cleanSchedules() {
}

Set<String> schedulesToDelete = new HashSet<>();

for (ScheduleEntry entry : finished) {
if (System.currentTimeMillis() >= entry.getExecutionStateChangeDate() + entry.getEditGracePeriod()) {
long finishDate;

// If grace period is unset - use the executionStateChangeDate as finishDate to avoid unnecessarily keeping schedules around
if (entry.getEditGracePeriod() == 0) {
finishDate = entry.getEnd() + entry.getEditGracePeriod();
} else {
finishDate = entry.getExecutionStateChangeDate();
}

if (System.currentTimeMillis() >= finishDate) {
schedulesToDelete.add(entry.scheduleId);
}
}
Expand Down

0 comments on commit 5cbcece

Please sign in to comment.