Index: varnish.module
===================================================================
--- varnish.module	(revision 3951)
+++ varnish.module	(working copy)
@@ -143,21 +143,25 @@
  * This borrows logic from cache_clear_all() to respect cache_lifetime.
  */
 function varnish_flush_caches() {
-  if (variable_get('varnish_flush_cron', 0)) {
-    if (variable_get('cache_lifetime', 0)) {
-      $cache_flush = variable_get('cache_flush_varnish', 0);
-      if ($cache_flush == 0) {
-        // This is the first request to clear the cache, start a timer.
-        variable_set('cache_flush_varnish', time());
-      }
-      else if (time() > ($cache_flush + variable_get('cache_lifetime', 0))) {
-        varnish_purge_all_pages();
-      }
+
+  //If this hook is called by CRON and the Varnish CRON flush is disabled, do not run
+  if (variable_get('cron_semaphore', FALSE) && !variable_get('varnish_flush_cron', FALSE)){
+    return; 
+  }
+  
+  if (variable_get('cache_lifetime', 0)) {
+    $cache_flush = variable_get('cache_flush_varnish', 0);
+    if ($cache_flush == 0) {
+      // This is the first request to clear the cache, start a timer.
+      variable_set('cache_flush_varnish', time());
     }
-    else {
+    else if (time() > ($cache_flush + variable_get('cache_lifetime', 0))) {
       varnish_purge_all_pages();
     }
   }
+  else {
+    varnish_purge_all_pages();
+  }
 }
 
 /**
