()
| 17 | } |
| 18 | |
| 19 | switchToNextKey() { |
| 20 | if (this.userToken) { |
| 21 | console.log('توکن کاربر استفاده میشود، تعویض کلید غیرفعال است.'); |
| 22 | return; // اگر توکن کاربر باشد، تعویض کلید غیرفعال است |
| 23 | } |
| 24 | this.currentIndex = (this.currentIndex + 1) % this.keys.length; |
| 25 | console.log(`تعویض به کلید API جدید: ${this.getCurrentKey()}`); |
| 26 | } |
| 27 | |
| 28 | async fetchWithKeySwitch(urlTemplate, maxRetriesPerKey = 3) { |
| 29 | let attempts = 0; |
no test coverage detected