You are here

public function DigestBase::processDigest in Message Digest 8

Determine if it is time to process this digest or not.

Return value

bool Returns TRUE if a sufficient amount of time has passed.

Overrides DigestInterface::processDigest

File

src/Plugin/Notifier/DigestBase.php, line 206

Class

DigestBase
Message Digest notifier.

Namespace

Drupal\message_digest\Plugin\Notifier

Code

public function processDigest() {
  $interval = $this
    ->getInterval();
  $key = $this->pluginId . '_last_run';
  $last_run = $this->state
    ->get($key, 0);

  // Allow some buffer for environmental differences that cause minor
  // variations in the request times. This will prevent digest processing from
  // being pushed to the next cron run when it really should be going this
  // time.
  $buffer = 30;
  return $last_run < strtotime('-' . $interval, $this->time
    ->getRequestTime()) + $buffer;
}