[Groonga-commit] groonga/gcs [master] Accept "interval" option to send requests

Back to archive index

YUKI Hiroshi null+****@clear*****
Thu Nov 15 10:12:51 JST 2012


YUKI Hiroshi	2012-11-15 10:12:51 +0900 (Thu, 15 Nov 2012)

  New Revision: bc03cfb4f967dd547df08f4ef82da0dbadedb9d5
  https://github.com/groonga/gcs/commit/bc03cfb4f967dd547df08f4ef82da0dbadedb9d5

  Log:
    Accept "interval" option to send requests

  Modified files:
    tools/run-scenarios
    tools/scenario-runner.js

  Modified: tools/run-scenarios (+4 -0)
===================================================================
--- tools/run-scenarios    2012-11-14 20:18:55 +0900 (0ceb54c)
+++ tools/run-scenarios    2012-11-15 10:12:51 +0900 (312f510)
@@ -32,6 +32,10 @@ commandLine
   .option('--acs',
           'Process requests for Amazon CloudSearch.',
           String)
+  .option('--interval <interval>',
+          'Interval to send requests (in msec).',
+          Number,
+          0)
   .parseClient();
 
 var scenariosDir;

  Modified: tools/scenario-runner.js (+9 -2)
===================================================================
--- tools/scenario-runner.js    2012-11-14 20:18:55 +0900 (5c3dcce)
+++ tools/scenario-runner.js    2012-11-15 10:12:51 +0900 (3ec2452)
@@ -37,7 +37,11 @@ ScenariosRunner.prototype._process = function(params) {
 
     runner.on('end', function(event) {
       if (params.scenarios.length) {
-        self._process(params);
+        if (self.options.interval)
+          setTimeout(function() { self._process(params); },
+                     self.options.interval);
+        else
+          self._process(params);
       } else {
         var elapsedTime = Date.now() - params.start;
         self.emit('end', { elapsedTime: elapsedTime });
@@ -134,7 +138,10 @@ ScenarioRunner.prototype._process = function(scenario, callback) {
 
     request.response = output;
     self.emit('request:end', { scenario: scenario, request: request });
-    processNext();
+    if (self.options.interval)
+      setTimeout(processNext, self.options.interval);
+    else
+      processNext();
   });
 };
 
-------------- next part --------------
HTML����������������������������...
다운로드 



More information about the Groonga-commit mailing list
Back to archive index