MCPcopy
hub / github.com/didi/mpx / workingRequest

Method workingRequest

packages/fetch/src/queue.js:83–98  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

81 }
82
83 workingRequest () {
84 while (this.workingList.length < this.limit && this.workList.length) {
85 const work = this.workList.shift()
86 this.workingList.push(work)
87 this.run(work)
88 }
89 // 对低优先级请求总有所保留,为之后的正常请求提供一个buffer
90 const buffer = parseInt((this.limit - this.workingList.length) * this.ratio, 10) || 1
91 const limit = this.limit - buffer
92 while (this.workingList.length < limit && this.lowWorkList.length) {
93 const work = this.lowWorkList.shift()
94 this.workingList.push(work)
95 this.run(work)
96 }
97 this.flushing = false
98 }
99
100 requestComplete (work) {
101 this.delWorkQueue(work)

Callers 1

flushQueueMethod · 0.95

Calls 2

runMethod · 0.95
pushMethod · 0.80

Tested by

no test coverage detected