Ejemplo n.º 1
0
      (function launch() {
        mongo_runner.launch_mongo(
          meteors.root.dir,
          mongo_port,
          function () { // On Mongo startup complete
          },
          function (code, signal) { // On Mongo dead
            console.log("Unexpected mongo exit code " + code + ". Restarting.");

            // if mongo dies 3 times with less than 5 seconds between each,
            // declare it failed and die.
            mongo_err_count += 1;

            if (mongo_err_count >= 3) {
              console.log("Can't start mongod. Check for other processes listening on port " + mongo_port + " or other meteors running in the same project.");
              process.exit(1);
            }
            if (mongo_err_timer)
              clearTimeout(mongo_err_timer);
            mongo_err_timer = setTimeout(function () {
              mongo_err_count = 0;
              mongo_err_timer = null;
            }, 5000);

            // Wait a sec to restart.
            setTimeout(launch, 1000);
          })
      })();
Ejemplo n.º 2
0
  var launch = function () {
    Status.mongoHandle = mongo_runner.launch_mongo(
      app_dir,
      mongo_port,
      function () { // On Mongo startup complete
        // don't print mongo startup is slow warning.
        if (mongo_startup_print_timer) {
          clearTimeout(mongo_startup_print_timer);
          mongo_startup_print_timer = null;
        }
        // print startup if we haven't already.
        if (process_startup_printer) {
          process_startup_printer();
          process_startup_printer = null;
        }
        restart_server();
      },
      function (code, signal) { // On Mongo dead
        if (Status.shuttingDown) {
          return;
        }
        console.log("Unexpected mongo exit code " + code + ". Restarting.");

        // if mongo dies 3 times with less than 5 seconds between each,
        // declare it failed and die.
        mongo_err_count += 1;
        if (mongo_err_count >= 3) {
          var explanation = mongoExitCodes.Codes[code];
          console.log("Can't start mongod\n");
          if (explanation)
            console.log(explanation.longText);
          if (explanation === mongoExitCodes.EXIT_NET_ERROR)
            console.log("\nCheck for other processes listening on port " + mongo_port +
                        "\nor other meteors running in the same project.");
          process.exit(1);
        }
        if (mongo_err_timer)
          clearTimeout(mongo_err_timer);
        mongo_err_timer = setTimeout(function () {
          mongo_err_count = 0;
          mongo_err_timer = null;
        }, 5000);

        // Wait a sec to restart.
        setTimeout(launch, 1000);
      });
  };
Ejemplo n.º 3
0
  var launch = function () {
    mongo_runner.launch_mongo(
      app_dir,
      mongo_port,
      function () { // On Mongo startup complete
        // don't print mongo startup is slow warning.
        if (mongo_startup_print_timer) {
          clearTimeout(mongo_startup_print_timer);
          mongo_startup_print_timer = null;
        }
        // print startup if we haven't already.
        if (process_startup_printer) {
          process_startup_printer();
          process_startup_printer = null;
        }
        restart_server();
      },
      function (code, signal) { // On Mongo dead
        console.log("Unexpected mongo exit code " + code + ". Restarting.");

        // if mongo dies 3 times with less than 5 seconds between each,
        // declare it failed and die.
        mongo_err_count += 1;
        if (mongo_err_count >= 3) {
          console.log("Can't start mongod. Check for other processes listening on port " + mongo_port + " or other meteors running in the same project.");
          process.exit(1);
        }
        if (mongo_err_timer)
          clearTimeout(mongo_err_timer);
        mongo_err_timer = setTimeout(function () {
          mongo_err_count = 0;
          mongo_err_timer = null;
        }, 5000);

        // Wait a sec to restart.
        setTimeout(launch, 1000);
      });
  };