Permalink
Browse files

Simplifying code.

  • Loading branch information...
1 parent c504daa commit 42fd6148324b987672b64d0aa1c4d698489630fe Andre Rodrigues committed Aug 6, 2012
Showing with 3 additions and 10 deletions.
  1. +1 −10 lib/serviceruntime/roleenvironment.js
  2. +2 −0 test/serviceruntime/roleenvironment-tests.js
View
11 lib/serviceruntime/roleenvironment.js
@@ -423,14 +423,7 @@ RoleEnvironment._processGoalStateChange = function (newGoalState, callback) {
changes.cancel = function () {
changes.cancelled = true;
- var newState = {
- clientId: RoleEnvironment.clientId,
- incarnation: currentGoalState.incarnation,
- status: ServiceRuntimeConstants.RoleStatus.RECYCLE,
- expiration: maxDateTime
- };
-
- RoleEnvironment.runtimeClient.setCurrentState(newState, optionalCallback);
+ RoleEnvironment.requestRecycle(optionalCallback);
}
RoleEnvironment.emit(ServiceRuntimeConstants.CHANGING, changes);
@@ -448,8 +441,6 @@ RoleEnvironment._processGoalStateChange = function (newGoalState, callback) {
optionalCallback();
}
});
- } else {
- optionalCallback();
}
}
} else {
View
2 test/serviceruntime/roleenvironment-tests.js
@@ -1177,7 +1177,9 @@ suite('roleenvironment-tests', function () {
azure.RoleEnvironment.on(ServiceRuntimeConstants.CHANGING, function (changes) {
changes.cancel();
+ });
+ sandbox.stub(azure.RoleEnvironment, 'requestRecycle', function () {
clearInterval(serverGoalStateInterval);
serverVersions.on('close', function () {

0 comments on commit 42fd614

Please sign in to comment.