You are here

public function RadioactivityMemcachedIncidentStorage::processIncidents in Radioactivity 7.2

Process incidents in the deferred queue

Overrides RadioactivityIncidentStorage::processIncidents

File

includes/RadioactivityMemcachedIncidentStorage.inc, line 58
Memcached incident storage class

Class

RadioactivityMemcachedIncidentStorage
@file Memcached incident storage class

Code

public function processIncidents() {
  $mc = $this
    ->connect();
  if (!$mc) {
    return;
  }
  $i = 0;

  // get and reset top
  $to = $mc
    ->get(VAR_RADIOACTIVITY_MEMCACHED_PREFIX . "radioactivity_top");
  $mc
    ->set(VAR_RADIOACTIVITY_MEMCACHED_PREFIX . "radioactivity_top", 0);
  if (!$to) {
    $to = 0;
  }
  while ($i < $to) {
    $incident = $mc
      ->get(VAR_RADIOACTIVITY_MEMCACHED_PREFIX . "radioactivity_incident_" . $i);
    if ($incident && $incident
      ->floodCheck()) {
      $incident
        ->updateEnergy();
    }
    $i++;
  }
}