Notify.php
authorAlan Knowles <alan@akbkhome.com>
Wed, 6 Apr 2011 08:22:57 +0000 (16:22 +0800)
committerAlan Knowles <alan@akbkhome.com>
Wed, 6 Apr 2011 08:22:57 +0000 (16:22 +0800)
Notify.php

index d7892c7..36aad25 100644 (file)
@@ -36,14 +36,27 @@ class Pman_Core_Notify extends Pman
         
         $w = DB_DataObject::factory('core_notify');
         $w->whereAdd('act_when < sent');
-        $w->fetchAll('id');
-        $w->limit(1000);
-        
-        
-        
-        
-        
+        $w->orderBy('act_when ASC'); // oldest first.
+        $w->limit(1000); // we can run 1000 ...
+        $ar = $w->fetchAll('id');
+        
+        while (true) {
+            if (empty($ar)) {
+                break;
+            }
+            if (!$this->poolfree()) {
+                sleep(10);
+                continue;
+            }
+            $p = array_shift($ar);
+            $this->run($p);
+        }
         
          
     }
+    
+    function run($id) {
+        
+    }
+    
 }
\ No newline at end of file