title: Javascript recursive promise stuck in infinite loop
body: <p>I have created a recursive promise function:</p>
  
  <pre><code>this.testFunction = Bluebird.method(function (instanceID) {
          var object = this;
          return object.canSsh(instanceID)
          .then(function (sshable) {
              if (sshable) {
                  return object.onSshable(instanceID)
                  .then(function () {
                      return Bluebird.resolve();
                  });
              }
              else {
                  return Bluebird.delay((SSH_POLLING_INTERVAL * 1000))
                  .then(function () {
                      return object.testFunction(instanceID);
                  });
              }
          })
          .catch(function (err) {
              return Bluebird.reject(err);
          });
      });
  </code></pre>
  
  <p>However, even when <code>sshable</code> becomes true, this function keeps recursively going on and on in an infinite loop. I expected that once I return from the <code>sshable</code> block, it should exist the function.</p>