MCPcopy Index your code
hub / github.com/hoothin/UserScripts / _processQueue

Method _processQueue

Picviewer CE+/dist.user.js:12135–12156  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12133 }
12134
12135 _processQueue() {
12136 if (this.activeCount >= this.concurrency || this.queue.length === 0) {
12137 return;
12138 }
12139
12140 this.activeCount++;
12141 const { url, resolve, reject } = this.queue.shift();
12142
12143 this._fetchByHead(url)
12144 .then(size => {
12145 if (size !== null) this.cache.set(url, size);
12146 resolve(size);
12147 })
12148 .catch(err => {
12149 console.warn(`Fetch size failed for ${url}`, err);
12150 resolve(null);
12151 })
12152 .finally(() => {
12153 this.activeCount--;
12154 this._processQueue();
12155 });
12156 }
12157
12158 _fetchByHead(url) {
12159 return new Promise((resolve, reject) => {

Callers 1

_scheduleRequestMethod · 0.95

Calls 2

_fetchByHeadMethod · 0.95
resolveFunction · 0.70

Tested by

no test coverage detected