diff --git a/activity.module b/activity.module
index 64661db..464337b 100644
--- a/activity.module
+++ b/activity.module
@@ -836,37 +836,45 @@ function activity_views_api() {
  * Implementation of hook_cron().
  */
 function activity_cron() {
-  // default is 2 weeks 0
-  $expire = variable_get('activity_expire', 0);
-  $min = variable_get('activity_min_count', 0);
-  if (!empty($expire) && empty($min)) {
-    db_query("DELETE m, at, aa, a FROM {activity} a
-             LEFT JOIN {activity_access} aa ON aa.aid = a.aid
-             INNER JOIN {activity_targets} at ON at.aid = a.aid
-             INNER JOIN {activity_messages} m ON m.amid = at.amid
-             WHERE a.created < %d", $_SERVER['REQUEST_TIME'] - $expire
-    );
-  }
-  elseif (!empty($expire)) {
-    // SELECT members with the min number of activies and they have an min(created) older then the expire
-    $uid_sql = "SELECT uid, min(created) as min, count(aid) as count FROM {activity} GROUP BY uid HAVING min < %d AND count > %d";
-    $uid_result = db_query($uid_sql, $_SERVER['REQUEST_TIME'] - $expire, $min);
-    $uids = array();
-    while ($uid_obj = db_fetch_object($uid_result)) {
-      $uids[] = $uid_obj->uid;
-    }
-    
-    if (!empty($uids)) {
-      // DELETE where uid IN () ^^ AND a.created < expire
-      $args = array_merge($uids, array($_SERVER['REQUEST_TIME'] - $expire));
+
+  // Avoid expiring old activity records more than once every 12 hours by
+  // default.
+  if ((time() - variable_get('activity_cron_last_run', 0)) > variable_get('activity_cron_threshold', 60 * 60 * 12)) {
+    variable_set('activity_cron_last_run', time());
+
+    // default is 2 weeks 0
+    $expire = variable_get('activity_expire', 0);
+    $min = variable_get('activity_min_count', 0);
+
+    if (!empty($expire) && empty($min)) {
       db_query("DELETE m, at, aa, a FROM {activity} a
-             LEFT JOIN {activity_access} aa ON aa.aid = a.aid
-             INNER JOIN {activity_targets} at ON at.aid = a.aid
-             INNER JOIN {activity_messages} m ON m.amid = at.amid
-             WHERE a.uid IN(" . db_placeholders($uids) . ")
-             AND a.created < %d", $args
+               LEFT JOIN {activity_access} aa ON aa.aid = a.aid
+               INNER JOIN {activity_targets} at ON at.aid = a.aid
+               INNER JOIN {activity_messages} m ON m.amid = at.amid
+               WHERE a.created < %d", $_SERVER['REQUEST_TIME'] - $expire
       );
     }
+    elseif (!empty($expire)) {
+      // SELECT members with the min number of activies and they have an min(created) older then the expire
+      $uid_sql = "SELECT uid, min(created) as min, count(aid) as count FROM {activity} GROUP BY uid HAVING min < %d AND count > %d";
+      $uid_result = db_query($uid_sql, $_SERVER['REQUEST_TIME'] - $expire, $min);
+      $uids = array();
+      while ($uid_obj = db_fetch_object($uid_result)) {
+        $uids[] = $uid_obj->uid;
+      }
+      
+      if (!empty($uids)) {
+        // DELETE where uid IN () ^^ AND a.created < expire
+        $args = array_merge($uids, array($_SERVER['REQUEST_TIME'] - $expire));
+        db_query("DELETE m, at, aa, a FROM {activity} a
+               LEFT JOIN {activity_access} aa ON aa.aid = a.aid
+               INNER JOIN {activity_targets} at ON at.aid = a.aid
+               INNER JOIN {activity_messages} m ON m.amid = at.amid
+               WHERE a.uid IN(" . db_placeholders($uids) . ")
+               AND a.created < %d", $args
+        );
+      }
+    }
   }
 }
 
@@ -1080,4 +1088,4 @@ function template_preprocess_views_view_activity_row_rss(&$vars) {
   $vars['node_title'] = check_plain($item->node_title);
   $vars['node_link'] = check_url(url('node/'. $item->node_nid, array('absolute' => TRUE)));
   $vars['created'] = date('D, d M Y H:i:s O', $item->created);
-}
\ No newline at end of file
+}
