[Groonga-commit] groonga/gcs [master] Don't break source array of requests

Back to archive index

YUKI Hiroshi null+****@clear*****
Mon Nov 12 19:29:43 JST 2012


YUKI Hiroshi	2012-11-12 19:29:43 +0900 (Mon, 12 Nov 2012)

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

  Log:
    Don't break source array of requests

  Modified files:
    tools/scenario-runner.js

  Modified: tools/scenario-runner.js (+7 -5)
===================================================================
--- tools/scenario-runner.js    2012-11-12 19:05:36 +0900 (9cb33e2)
+++ tools/scenario-runner.js    2012-11-12 19:29:43 +0900 (0d512ed)
@@ -44,19 +44,19 @@ Runner.prototype = {
   },
 
   _processScenario: function(scenario, callback) {
-    if (!scenario.start) {
+    if (!scenario.toBeProcessedRequests) {
+      scenario.toBeProcessedRequests = scenario.requests.slice(0);
       scenario.start = Date.now();
+      scenario.processed = {};
       if (this.globalCallback)
         this.globalCallback(null, { type: 'scenario:start',
                                     scenario: scenario });
     }
-    if (!scenario.processed)
-      scenario.processed = {};
 
-    var request = scenario.requests.shift();
+    var request = scenario.toBeProcessedRequests.shift();
     var self = this;
     function processNext() {
-      if (scenario.requests.length) {
+      if (scenario.toBeProcessedRequests.length) {
         self._processScenario(scenario, callback);
       } else {
         var elapsedTime = Date.now() - scenario.start;
@@ -92,6 +92,8 @@ Runner.prototype = {
         if (self.globalCallback)
           self.globalCallback(null, { type: 'error',
                                       statusCode: statusCode });
+        if (callback)
+          callback(statusCode, null);
         return;
       }
 
-------------- next part --------------
HTML����������������������������...
Télécharger 



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