You are here

function progress_set_intervalled_progress in Background Process 8

Set intervalled progress.

1 call to progress_set_intervalled_progress()
BackgroundBatchContext::offsetSet in background_batch/src/BackgroundBatchContext.php
Implements to Update progress if needed.

File

progress/progress.module, line 84
Progress framework for keeping track of progresses. @todo Force MyISAM for table {progress} to avoid transaction/isolation level problems, and use INSERT DELAYED for performance.

Code

function progress_set_intervalled_progress($name, $message, $progress, $interval = NULL) {
  static $set = [];
  if (isset($interval, $set[$name])) {
    if ($set[$name] + $interval > microtime(TRUE)) {
      return TRUE;
    }
  }
  $result = progress_set_progress($name, $message, $progress);
  $set[$name] = microtime(TRUE);
  return $result;
}