You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* The maximum size of the priority heap. This limits the number of requests that are sorted by priority. Only applies to requests that are not yet active.
107
+
* The maximum length of the priority queue. This limits the number of requests that are sorted by priority. Only applies to requests that are not yet active.
116
108
*
117
109
* @memberof RequestScheduler
118
110
*
119
111
* @type {Number}
120
112
* @default 20
113
+
*
114
+
* @private
121
115
*/
122
-
priorityHeapLength : {
116
+
requestQueueLength : {
123
117
get : function(){
124
-
returnpriorityHeapLength;
118
+
returnrequestQueueLength;
125
119
},
126
120
set : function(value){
127
-
// If the new length shrinks the heap, need to cancel some of the requests.
128
-
// Since this value is not intended to be tweaked regularly it is fine to just cancel the high priority requests.
129
-
if(value<priorityHeapLength){
130
-
while(requestHeap.length>value){
131
-
varrequest=requestHeap.pop();
132
-
cancelRequest(request);
133
-
}
121
+
// Cancel all requests and resize the queue
122
+
varlength=requestQueue.length;
123
+
for(vari=0;i<length;++i){
124
+
varrequest=requestQueue.get(i);
125
+
cancelRequest(request);
134
126
}
135
-
priorityHeapLength=value;
136
-
requestHeap.maximumLength=value;
137
-
requestHeap.reserve(value);
127
+
requestQueue=newRequestQueue(value);
128
+
RequestScheduler.requestQueue=requestQueue;
138
129
}
139
130
}
140
131
});
@@ -242,21 +233,19 @@ define([
242
233
}
243
234
activeRequests.length-=removeCount;
244
235
245
-
// Update priority of issued requests and resort the heap
246
-
varissuedRequests=requestHeap.internalArray;
247
-
varissuedLength=requestHeap.length;
248
-
for(i=0;i<issuedLength;++i){
249
-
updatePriority(issuedRequests[i]);
250
-
}
251
-
requestHeap.resort();
236
+
// Update priority of issued requests and resort the queue
237
+
requestQueue.forEach(updatePriority);
238
+
requestQueue.sort();
252
239
253
240
// Get the number of open slots and fill with the highest priority requests.
254
241
// Un-throttled requests are automatically added to activeRequests, so activeRequests.length may exceed maximumRequests
0 commit comments