diff --git a/src/infrastructure/daemon/workers/storage/PhabricatorWorkerTrigger.php b/src/infrastructure/daemon/workers/storage/PhabricatorWorkerTrigger.php index 0fe4943237..abbe095670 100644 --- a/src/infrastructure/daemon/workers/storage/PhabricatorWorkerTrigger.php +++ b/src/infrastructure/daemon/workers/storage/PhabricatorWorkerTrigger.php @@ -130,6 +130,26 @@ final class PhabricatorWorkerTrigger } + /** + * Predict the epoch at which this trigger will next fire. + * + * @return int|null Epoch when the event will next fire, or `null` if it is + * not planned to trigger. + */ + public function getNextEventPrediction() { + // NOTE: We're basically echoing the database state here, so this won't + // necessarily be accurate if the caller just updated the object but has + // not saved it yet. That's a weird use case and would require more + // gymnastics, so don't bother trying to get it totally correct for now. + + if ($this->getEvent()) { + return $this->getEvent()->getNextEpoch(); + } else { + return $this->getNextEventEpoch(null, $is_reschedule = false); + } + } + + /* -( PhabricatorDestructibleInterface )----------------------------------- */