diff --git a/sites/all/modules/contrib/radioactivity/radioactivity.module b/sites/all/modules/contrib/radioactivity/radioactivity.module
index 712a050..2832c14 100644
--- a/sites/all/modules/contrib/radioactivity/radioactivity.module
+++ b/sites/all/modules/contrib/radioactivity/radioactivity.module
@@ -429,141 +429,150 @@ function radioactivity_cron() {
 
   module_load_include("inc", "radioactivity", "radioactivity-bootstrap");
 
-  if (class_exists("Memcache") || class_exists("Memcached")) {
-    // Expose the memcache settings for the memcache processIncident call
-    if (!defined("VAR_RADIOACTIVITY_MEMCACHED_HOST")) {
-      define("VAR_RADIOACTIVITY_MEMCACHED_HOST", variable_get("radioactivity_memcached_host", "localhost"));
-      define("VAR_RADIOACTIVITY_MEMCACHED_PORT", variable_get("radioactivity_memcached_port", "11211"));
+  if (lock_acquire('radioactivity_cron', 120)) {
+    if (class_exists("Memcache") || class_exists("Memcached")) {
+      // Expose the memcache settings for the memcache processIncident call
+      if (!defined("VAR_RADIOACTIVITY_MEMCACHED_HOST")) {
+        define("VAR_RADIOACTIVITY_MEMCACHED_HOST", variable_get("radioactivity_memcached_host", "localhost"));
+        define("VAR_RADIOACTIVITY_MEMCACHED_PORT", variable_get("radioactivity_memcached_port", "11211"));
+      }
     }
-  }
 
-  if (class_exists("Redis")) {
-    // Expose the redis settings for the memcache processIncident call
-    if (!defined("VAR_RADIOACTIVITY_REDIS_HOST")) {
-      define("VAR_RADIOACTIVITY_REDIS_HOST", variable_get("radioactivity_redis_host", "localhost"));
-      define("VAR_RADIOACTIVITY_REDIS_PORT", variable_get("radioactivity_redis_port", "6379"));
+    if (class_exists("Redis")) {
+      // Expose the redis settings for the memcache processIncident call
+      if (!defined("VAR_RADIOACTIVITY_REDIS_HOST")) {
+        define("VAR_RADIOACTIVITY_REDIS_HOST", variable_get("radioactivity_redis_host", "localhost"));
+        define("VAR_RADIOACTIVITY_REDIS_PORT", variable_get("radioactivity_redis_port", "6379"));
+      }
     }
-  }
 
-  $last_cron_timestamp = variable_get('radioactivity_last_cron_timestamp', REQUEST_TIME);
+    $last_cron_timestamp = variable_get('radioactivity_last_cron_timestamp', REQUEST_TIME);
 
-  $fields = field_info_fields();
+    $fields = field_info_fields();
 
-  foreach ($fields as $field_name => &$field) {
+    foreach ($fields as $field_name => &$field) {
 
-    if ($field['type'] != RADIOACTIVITY_FIELD_TYPE) {
-      continue;
-    }
+      if ($field['type'] != RADIOACTIVITY_FIELD_TYPE) {
+        continue;
+      }
 
-    foreach ($field['bundles'] as $entity_type => &$bundles) {
-      foreach ($bundles as $bundle) {
-
-        $profile = radioactivity_get_field_profile($entity_type, $bundle, $field_name);
-
-        if (!($profile && $profile->storageObject)) {
-          watchdog(
-            "radioactivity",
-            "Could not load profile for @type @bundle @field",
-            array("@type" => $entity_type, "@bundle" => $bundle, "@field" => $field_name),
-            WATCHDOG_ERROR
-          );
-          continue;
-        }
-
-        $storage = $profile->storageObject;
-
-        // Process incidents (Note: this will process all incidents within the
-        // storage, even those unrelated to THIS entity).
-        $storage->processIncidents();
-
-        // Check granularity
-        $threshold_timestamp = $last_cron_timestamp - ($last_cron_timestamp % $profile->granularity) + $profile->granularity;
-
-        // Update field database
-        $half_life = $profile->half_life;
-        $cut_off = $profile->cut_off;
-
-        $table_name = 'field_data_' . $field_name;
-        $energy     = $field_name . '_' . RADIOACTIVITY_FIELD_ENERGY;
-        $timestamp  = $field_name . '_' . RADIOACTIVITY_FIELD_TIMESTAMP;
-
-        // grab update value from deferred values table
-        // and update it to the fields table if it is used
-        if ($profile->enable_decay > 0 && REQUEST_TIME > $threshold_timestamp) {
-
-          // Switched deletion and decaying order because in
-          // some cases the decaying stops working when there are sh*tloads of fields.
-          // Brute deletion of the field might not be ok but the field api can handle this
-
-          // TODO: figure out how to do this in batches...
-
-          if (module_exists('rules')) {
-            // Invoke rules event for cut off
-            $items = db_select($table_name, 't')
-               ->fields('t', array('entity_type', 'entity_id'))
-               ->condition($energy, $cut_off, '<')
-               ->condition("deleted", "0")
-               ->execute();
-
-            while ($item = $items->fetchObject()) {
-              // Don't cache - conserves memory
-              $entity = entity_load($item->entity_type, array($item->entity_id), array(), TRUE);
-              $entity = entity_metadata_wrapper($item->entity_type, array_shift($entity));
-              rules_invoke_event('radioactivity_field_cut_off', $entity);
-            }
+      foreach ($field['bundles'] as $entity_type => &$bundles) {
+        foreach ($bundles as $bundle) {
+
+          $profile = radioactivity_get_field_profile($entity_type, $bundle, $field_name);
 
+          if (!($profile && $profile->storageObject)) {
+            watchdog(
+              "radioactivity",
+              "Could not load profile for @type @bundle @field",
+              array("@type" => $entity_type, "@bundle" => $bundle, "@field" => $field_name),
+              WATCHDOG_ERROR
+            );
+            continue;
           }
 
-          $cuts = db_delete($table_name)
-            ->condition($energy, $cut_off, '<')
-            ->condition("deleted", "0")
-            ->execute();
-
-          // Run the updates
-          $updated = db_update($table_name)
-            ->expression($energy, $energy . ' * pow(2, (' . $timestamp . ' * 1.0 - ' . REQUEST_TIME . ') / ' . $half_life . ')')
-            ->fields(array($timestamp => REQUEST_TIME))
-            ->condition($timestamp, REQUEST_TIME, '<')
-            ->condition("deleted", "0")
-            ->execute();
-        } // Decay
-
-        $field_info = field_info_instance($entity_type, $field_name, $bundle);
-
-        if ($field_info['settings']['history'] == 1) {
-          db_query("INSERT INTO {radioactivity_history}"
-            . " (SELECT :id, entity_id, :time, " . $energy
-            . " FROM " . $table_name
-            . " WHERE deleted = 0)",
-            array(':id' => $field_info['id'], ':time' => REQUEST_TIME)
-          );
-
-          $time = REQUEST_TIME - ($field_info['settings']['history_limit'] * 60 * 60);
-
-          db_delete('radioactivity_history')
-            ->condition('time', $time, '<')
-            ->condition('field_instance_id', $field_info['id'])
-            ->execute();
-        } // History
-
-      } // Bundles
-
-      // Clear the entity caches.
-      entity_get_controller($entity_type)->resetCache();
-    }
-  }
+          $storage = $profile->storageObject;
+
+          // Process incidents (Note: this will process all incidents within the
+          // storage, even those unrelated to THIS entity).
+          $storage->processIncidents();
+
+          // Check granularity
+          $threshold_timestamp = $last_cron_timestamp - ($last_cron_timestamp % $profile->granularity) + $profile->granularity;
 
-  // remove events that are twice as old as the timeout is
-  $timeout2 = variable_get('radioactivity_flood_timeout', 15) * 120;
+          // Update field database
+          $half_life = $profile->half_life;
+          $cut_off = $profile->cut_off;
 
-  // Groom the flood cache
-  db_delete('radioactivity_flood_map')->condition('time', REQUEST_TIME - $timeout2, "<")->execute();
+          $table_name = 'field_data_' . $field_name;
+          $energy     = $field_name . '_' . RADIOACTIVITY_FIELD_ENERGY;
+          $timestamp  = $field_name . '_' . RADIOACTIVITY_FIELD_TIMESTAMP;
 
-  // clear field caches just to be sure
-  field_cache_clear();
+          // grab update value from deferred values table
+          // and update it to the fields table if it is used
+          if ($profile->enable_decay > 0 && REQUEST_TIME > $threshold_timestamp) {
 
-  variable_set('radioactivity_last_cron_timestamp', REQUEST_TIME);
+            // Switched deletion and decaying order because in
+            // some cases the decaying stops working when there are sh*tloads of fields.
+            // Brute deletion of the field might not be ok but the field api can handle this
 
+            if (module_exists('rules')) {
+              // Invoke rules event for cut off
+              $items = db_select($table_name, 't')
+                 ->fields('t', array('entity_type', 'entity_id'))
+                 ->condition($energy, $cut_off, '<')
+                 ->condition("deleted", "0")
+                 ->execute();
+
+              while ($item = $items->fetchObject()) {
+                // Don't cache - conserves memory
+                $entity = entity_load($item->entity_type, array($item->entity_id), array(), TRUE);
+                $entity = entity_metadata_wrapper($item->entity_type, array_shift($entity));
+                rules_invoke_event('radioactivity_field_cut_off', $entity);
+              }
+
+            }
+
+            $cuts = db_delete($table_name)
+              ->condition($energy, $cut_off, '<')
+              ->condition("deleted", "0")
+              ->execute();
+
+            // Run the updates
+            do {
+              $limit_size = variable_get('radioactivity_decay_batch_limit', 100);
+              $sql = "UPDATE {" . db_escape_table($table_name) . "} SET " . db_escape_field($energy) . "=" . db_escape_field($energy) . " * pow(2, (" . db_escape_field($timestamp) ." * 1.0 - :request_time ) / :half_life ), " . db_escape_field($timestamp) . "=:request_time
+                      WHERE " . db_escape_field($timestamp) . " < :request_time AND deleted = 0";
+              $params = array(':request_time' => REQUEST_TIME, ':half_life' => $half_life);
+
+              if ($limit_size) {
+                $sql .= ' LIMIT ' . (is_int($limit_size) ? $limit_size : 100);
+              }
+
+              $result = db_query($sql, $params);
+              if (!$result->rowCount() || !$limit_size) {
+                break;
+              }
+            } while (TRUE);
+          } // Decay
+
+          $field_info = field_info_instance($entity_type, $field_name, $bundle);
+
+          if ($field_info['settings']['history'] == 1) {
+            db_query("INSERT INTO {radioactivity_history}"
+              . " (SELECT :id, entity_id, :time, " . $energy
+              . " FROM " . $table_name
+              . " WHERE deleted = 0)",
+              array(':id' => $field_info['id'], ':time' => REQUEST_TIME)
+            );
+
+            $time = REQUEST_TIME - ($field_info['settings']['history_limit'] * 60 * 60);
+
+            db_delete('radioactivity_history')
+              ->condition('time', $time, '<')
+              ->condition('field_instance_id', $field_info['id'])
+              ->execute();
+          } // History
+
+        } // Bundles
+
+        // Clear the entity caches.
+        entity_get_controller($entity_type)->resetCache();
+      }
+    }
+
+    // remove events that are twice as old as the timeout is
+    $timeout2 = variable_get('radioactivity_flood_timeout', 15) * 120;
+
+    // Groom the flood cache
+    db_delete('radioactivity_flood_map')->condition('time', REQUEST_TIME - $timeout2, "<")->execute();
+
+    // clear field caches just to be sure
+    field_cache_clear();
+
+    variable_set('radioactivity_last_cron_timestamp', REQUEST_TIME);
+    lock_release('radioactivity_cron');
+  }
 }
 
 /**
