@tsteur opened this Pull Request on July 30th 2015 Owner

While working for a fix of #7692 in #8467 I noticed that Piwik API requests made via angularjs were never really aborted. You can reproduce this by opening the website selector, then type many letters quickly. You will notice in the network tab of developer tools that the requests are not aborted. They are all finished and it slows down all the requests.

The only way the aborting of requests worked was to call deferred.resolve() instead of deferred.reject(). I presume this is because the $http timeout config that is used to cancel a request only listens to the success callback here: https://github.com/angular/angular.js/blob/v1.2.28/src/ng/httpBackend.js#L136 . When calling reject() it won't trigger the success callback and won't abort the HTTP request.

It used to work via resolve() but was changed to reject() here: https://github.com/piwik/piwik/commit/2b72250738ba66a3f98d492d388016c984fe129f

This Pull Request was closed on August 17th 2015
Powered by GitHub Issue Mirror