Skip to content

Commit

Permalink
Revert "Fix schedule expiration bug (#3307)" (#3326)
Browse files Browse the repository at this point in the history
This reverts commit 5e144ff.
  • Loading branch information
ShellyWEI committed Aug 29, 2023
1 parent bfeead7 commit 6db7500
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 14 deletions.
10 changes: 0 additions & 10 deletions azkaban-common/src/main/java/azkaban/trigger/Trigger.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import java.util.concurrent.locks.ReentrantLock;
import org.apache.log4j.Logger;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;


public class Trigger {
Expand Down Expand Up @@ -191,17 +190,8 @@ public static Trigger fromJson(final Object obj) throws Exception {
}

public void updateNextCheckTime() {
// expireCondition's nextCheckTime is the pre-set value, for most cases it's DEFAULT_SCHEDULE_END_EPOCH_TIME,
// It is not truly reflecting the real expiration time, so we need to update trigger manually.
this.nextCheckTime = Math.min(this.triggerCondition.getNextCheckTime(),
this.expireCondition.getNextCheckTime());
// manually update trigger's expiration status based on whether the nextCheckTime is before now.
// As nextCheckTime is supposed to get the next valid time, so if it's before now, it means the trigger is expired.
final DateTimeZone timezone = DateTimeZone.getDefault();
final DateTime date = new DateTime(this.nextCheckTime).withZone(timezone);
if (date.isBeforeNow()) {
this.status = TriggerStatus.EXPIRED;
}
}

public long getNextCheckTime() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ private void checkAllTriggers() throws TriggerManagerException {
}
} catch (final Throwable th) {
//skip this trigger, moving on to the next one
TriggerManager.logger.error("Failed to process trigger with id : " + t, th.fillInStackTrace());
TriggerManager.logger.error("Failed to process trigger with id : " + t, th);
} finally {
t.unlock();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,7 @@ public Boolean eval() {
public void reset() {
final NextCheckTime nextCheckTimeObj = calculateNextCheckTime();
this.nextCheckTime = nextCheckTimeObj.nextValidCheckTimeFromNow;
if (nextCheckTimeObj.missedCheckTimeBeforeNow.size() > 0) {
nextCheckTimeObj.missedCheckTimeBeforeNow.remove(nextCheckTimeObj.missedCheckTimeBeforeNow.size() - 1);
}
nextCheckTimeObj.missedCheckTimeBeforeNow.remove(nextCheckTimeObj.missedCheckTimeBeforeNow.size() - 1);
this.missedCheckTimesBeforeNow = nextCheckTimeObj.missedCheckTimeBeforeNow;
}

Expand Down

0 comments on commit 6db7500

Please sign in to comment.