()
| 65 | |
| 66 | // Process the request queue with rate limit awareness |
| 67 | async processQueue() { |
| 68 | if (this.processingQueue || this.requestQueue.length === 0) { |
| 69 | return; |
| 70 | } |
| 71 | |
| 72 | this.processingQueue = true; |
| 73 | |
| 74 | while (this.requestQueue.length > 0) { |
| 75 | const request = this.requestQueue.shift(); |
| 76 | |
| 77 | try { |
| 78 | await this.checkRateLimit(); |
| 79 | const response = await this.makeRequestWithRetry(request.url, request.options); |
| 80 | this.updateRateLimitInfo(response); |
| 81 | request.resolve(response); |
| 82 | await this.delay(100); |
| 83 | } catch (error) { |
| 84 | request.reject(error); |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | this.processingQueue = false; |
| 89 | } |
| 90 | |
| 91 | // Check rate limit and wait if necessary |
| 92 | async checkRateLimit() { |
no test coverage detected