Google chrome AngularJS和Chrome的Bug,取消后挂起的套接字?
有人在AngularJS(1.0.7版)和Chrome(30.0.1599.114版)中看到过这个bug吗?在Chrome中,取消http GET请求会使套接字处于挂起状态,从而使线程池最大化 代码:Google chrome AngularJS和Chrome的Bug,取消后挂起的套接字?,google-chrome,angularjs,Google Chrome,Angularjs,有人在AngularJS(1.0.7版)和Chrome(30.0.1599.114版)中看到过这个bug吗?在Chrome中,取消http GET请求会使套接字处于挂起状态,从而使线程池最大化 代码: 您应该将AngularJS更新为1.1.5,以便能够取消http调用。 参考: 下面是工作代码和JS提琴。我已经用AngularJS 1.2.0和Chrome 32.0.1700.0 canary进行了测试 function Ctrl($rootScope, $scope, $http, $q,
您应该将AngularJS更新为1.1.5,以便能够取消http调用。 参考: 下面是工作代码和JS提琴。我已经用AngularJS 1.2.0和Chrome 32.0.1700.0 canary进行了测试
function Ctrl($rootScope, $scope, $http, $q, $timeout) {
var canceler = $q.defer();
console.log("Calling...");
$http.get("/echo/json", {
//Will return data after 5 seconds passed
data: {json: {id: "123"}, delay: 5},
timeout: canceler.promise
}).success(function (results) {
console.log("Success");
console.log(results);
}).
error(function (result) {
console.log("Error");
console.log(result);
});
$timeout(function () {
console.log("1 second passed");
// now, cancel it (before it may come back with data)
$rootScope.$apply(function () {
console.log("Canceling..");
canceler.resolve();
});
}, 1000);
}
请求已变为取消状态
您应该将AngularJS更新为1.1.5,以便能够取消http调用。 参考: 下面是工作代码和JS提琴。我已经用AngularJS 1.2.0和Chrome 32.0.1700.0 canary进行了测试
function Ctrl($rootScope, $scope, $http, $q, $timeout) {
var canceler = $q.defer();
console.log("Calling...");
$http.get("/echo/json", {
//Will return data after 5 seconds passed
data: {json: {id: "123"}, delay: 5},
timeout: canceler.promise
}).success(function (results) {
console.log("Success");
console.log(results);
}).
error(function (result) {
console.log("Error");
console.log(result);
});
$timeout(function () {
console.log("1 second passed");
// now, cancel it (before it may come back with data)
$rootScope.$apply(function () {
console.log("Canceling..");
canceler.resolve();
});
}, 1000);
}
请求已变为取消状态
您应该将AngularJS更新为1.1.5,以便能够取消http调用。 参考: 下面是工作代码和JS提琴。我已经用AngularJS 1.2.0和Chrome 32.0.1700.0 canary进行了测试
function Ctrl($rootScope, $scope, $http, $q, $timeout) {
var canceler = $q.defer();
console.log("Calling...");
$http.get("/echo/json", {
//Will return data after 5 seconds passed
data: {json: {id: "123"}, delay: 5},
timeout: canceler.promise
}).success(function (results) {
console.log("Success");
console.log(results);
}).
error(function (result) {
console.log("Error");
console.log(result);
});
$timeout(function () {
console.log("1 second passed");
// now, cancel it (before it may come back with data)
$rootScope.$apply(function () {
console.log("Canceling..");
canceler.resolve();
});
}, 1000);
}
请求已变为取消状态
您应该将AngularJS更新为1.1.5,以便能够取消http调用。 参考: 下面是工作代码和JS提琴。我已经用AngularJS 1.2.0和Chrome 32.0.1700.0 canary进行了测试
function Ctrl($rootScope, $scope, $http, $q, $timeout) {
var canceler = $q.defer();
console.log("Calling...");
$http.get("/echo/json", {
//Will return data after 5 seconds passed
data: {json: {id: "123"}, delay: 5},
timeout: canceler.promise
}).success(function (results) {
console.log("Success");
console.log(results);
}).
error(function (result) {
console.log("Error");
console.log(result);
});
$timeout(function () {
console.log("1 second passed");
// now, cancel it (before it may come back with data)
$rootScope.$apply(function () {
console.log("Canceling..");
canceler.resolve();
});
}, 1000);
}
请求已变为取消状态
您是否尝试过使用chrome的金丝雀版本查看是否修复?您是否尝试过使用chrome的金丝雀版本查看是否修复?您是否尝试过使用chrome的金丝雀版本查看是否修复?您是否尝试过使用chrome的金丝雀版本查看是否修复?