store CRM and LDAP entries in redis
[APKPM.git] / public / gearman.html
index 6692a55..82146f5 100644 (file)
@@ -3,16 +3,19 @@
  <script src="http://code.angularjs.org/angular-0.9.12.min.js" ng:autobind></script>
  <body>
   <script>
-    function GearmanCntl($xhr,$location) {
+    function GearmanCntl($xhr,$location,$defer) {
       var self = this;
+
       this.status_update = function() {
         $xhr('JSON', '/_g/status?callback=JSON_CALLBACK', function(code,response) {
           self.g = response;
         });
+        if ( self.status_interval > 0 ) {
+               $defer( self.status_update, self.status_interval * 1000 );
+       }
       }
+       this.status_interval = 5; // seconds
        this.status_update();
-      setInterval( this.status_update, 5000 );
 
        var a = $location.hashPath.split('/');
        self.function_name = a[0];
@@ -33,7 +36,7 @@
         self.response = null;
       };
     }
-    GearmanCntl.$inject = ['$xhr','$location'];
+    GearmanCntl.$inject = ['$xhr','$location','$defer'];
   </script>
   <div ng:controller="GearmanCntl">
     <select name="function_name">
@@ -65,6 +68,7 @@ response={{response}}
 </tr>
 </table>
 <button ng:click="status_update()">update</button>
+<input name=status_interval size=2>s
 
   </div>
  </body>