浏览代码

Update PriorityQueue constructor

Garrett Johnson 5 年之前
父节点
当前提交
72f48cafe9
共有 2 个文件被更改,包括 14 次插入6 次删除
  1. 12 4
      src/base/TilesRendererBase.js
  2. 2 2
      src/utilities/PriorityQueue.js

+ 12 - 4
src/base/TilesRendererBase.js

@@ -43,10 +43,18 @@ export class TilesRendererBase {
 		this.rootURL = url;
 		this.fetchOptions = {};
 
-		this.lruCache = new LRUCache();
-		this.lruCache.sortCallback = lruSort;
-		this.downloadQueue = new PriorityQueue( 4 );
-		this.parseQueue = new PriorityQueue( 1 );
+		const lruCache = new LRUCache();
+		lruCache.sortCallback = lruSort;
+
+		const downloadQueue = new PriorityQueue();
+		downloadQueue.maxJobs = 4;
+
+		const parseQueue = new PriorityQueue();
+		parseQueue.maxJobs = 1;
+
+		this.lruCache = lruCache;
+		this.downloadQueue = downloadQueue;
+		this.parseQueue = parseQueue;
 		this.stats = {
 			parsing: 0,
 			downloading: 0,

+ 2 - 2
src/utilities/PriorityQueue.js

@@ -1,9 +1,9 @@
 class PriorityQueue {
 
-	constructor( maxJobs = 6 ) {
+	constructor() {
 
 		// options
-		this.maxJobs = maxJobs;
+		this.maxJobs = 6;
 
 		this.items = [];
 		this.currJobs = 0;