remove pending requests and send message from tern-worker on Tern errors

This commit is contained in:
dloverin authored and Erik Tierney committed 2013-04-15 16:05:46 -04:00
1 parent 77a1b7f2a2
commit e5e028e535
2 files changed
+35 -20

No files matched your search

@@ -308,8 +308,22 @@ define(function (require, exports, module) {
function getPendingRequest(file, offset, type) {
var key = file + "@" + offset;
if (Object.prototype.hasOwnProperty.call(pendingTernRequests, key)) {
var requests = pendingTernRequests[key];
return requests[type];
var requests = pendingTernRequests[key],
requestType = requests[type],
anyProperties = false;
delete pendingTernRequests[key][type];
for (var prop in pendingTernRequests[key]) {
anyProperties = true;
break;
}
if (!anyProperties) {
delete pendingTernRequests[key];
}
return requestType;
}
}