Compare commits
No commits in common. "135ba8616f7a7841c0922016d434b9d8d44803b8" and "fef9ff6318e11f3d77fb1b5b04886e4d82f37d0d" have entirely different histories.
135ba8616f
...
fef9ff6318
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "real-debrid-downloader",
|
"name": "real-debrid-downloader",
|
||||||
"version": "1.7.20",
|
"version": "1.7.19",
|
||||||
"description": "Desktop downloader",
|
"description": "Desktop downloader",
|
||||||
"main": "build/main/main/main.js",
|
"main": "build/main/main/main.js",
|
||||||
"author": "Sucukdeluxe",
|
"author": "Sucukdeluxe",
|
||||||
|
|||||||
@ -1461,6 +1461,7 @@ export async function fetchDebridLinkHostLimits(apiKeysRaw: string, host = "rapi
|
|||||||
|
|
||||||
class DebridLinkClient {
|
class DebridLinkClient {
|
||||||
private apiKeys: ReturnType<typeof parseDebridLinkApiKeys>;
|
private apiKeys: ReturnType<typeof parseDebridLinkApiKeys>;
|
||||||
|
private currentKeyIndex: number = 0;
|
||||||
|
|
||||||
public constructor(apiKeysRaw: string) {
|
public constructor(apiKeysRaw: string) {
|
||||||
this.apiKeys = parseDebridLinkApiKeys(apiKeysRaw);
|
this.apiKeys = parseDebridLinkApiKeys(apiKeysRaw);
|
||||||
@ -1475,22 +1476,25 @@ class DebridLinkClient {
|
|||||||
throw new Error("Debrid-Link: Kein aktiver API-Key verfuegbar (deaktiviert oder am Tageslimit)");
|
throw new Error("Debrid-Link: Kein aktiver API-Key verfuegbar (deaktiviert oder am Tageslimit)");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Always start from first key — use first available, skip disabled/limited/cooldown.
|
let checkedKeys = 0;
|
||||||
// This ensures all parallel items use the same key until it's actually exhausted.
|
while (checkedKeys < this.apiKeys.length) {
|
||||||
for (let keyIdx = 0; keyIdx < this.apiKeys.length; keyIdx += 1) {
|
const apiKey = this.apiKeys[this.currentKeyIndex];
|
||||||
const apiKey = this.apiKeys[keyIdx];
|
checkedKeys += 1;
|
||||||
const keyLabel = this.apiKeys.length > 1 ? ` (${apiKey.label})` : "";
|
const keyLabel = this.apiKeys.length > 1 ? ` (${apiKey.label})` : "";
|
||||||
if (isDebridLinkApiKeyDisabled(settings, apiKey.id)) {
|
if (isDebridLinkApiKeyDisabled(settings, apiKey.id)) {
|
||||||
logger.info(`Debrid-Link${keyLabel}: uebersprungen (manuell deaktiviert), pruefe naechsten Key`);
|
logger.info(`Debrid-Link${keyLabel}: uebersprungen (manuell deaktiviert), pruefe naechsten Key`);
|
||||||
|
this.currentKeyIndex = (this.currentKeyIndex + 1) % this.apiKeys.length;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (isDebridLinkApiKeyDailyLimitReached(settings, apiKey.id)) {
|
if (isDebridLinkApiKeyDailyLimitReached(settings, apiKey.id)) {
|
||||||
logger.info(`Debrid-Link${keyLabel}: uebersprungen (lokales Tageslimit erreicht), pruefe naechsten Key`);
|
logger.info(`Debrid-Link${keyLabel}: uebersprungen (lokales Tageslimit erreicht), pruefe naechsten Key`);
|
||||||
|
this.currentKeyIndex = (this.currentKeyIndex + 1) % this.apiKeys.length;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const keyCooldownExpiry = debridLinkKeyCooldowns.get(apiKey.id);
|
const keyCooldownExpiry = debridLinkKeyCooldowns.get(apiKey.id);
|
||||||
if (keyCooldownExpiry && Date.now() < keyCooldownExpiry) {
|
if (keyCooldownExpiry && Date.now() < keyCooldownExpiry) {
|
||||||
logger.info(`Debrid-Link${keyLabel}: uebersprungen (Cooldown bis ${new Date(keyCooldownExpiry).toLocaleTimeString()}), pruefe naechsten Key`);
|
logger.info(`Debrid-Link${keyLabel}: uebersprungen (Cooldown bis ${new Date(keyCooldownExpiry).toLocaleTimeString()}), pruefe naechsten Key`);
|
||||||
|
this.currentKeyIndex = (this.currentKeyIndex + 1) % this.apiKeys.length;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1575,8 +1579,9 @@ class DebridLinkClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (keyIdx + 1 < this.apiKeys.length) {
|
this.currentKeyIndex = (this.currentKeyIndex + 1) % this.apiKeys.length;
|
||||||
const nextKey = this.apiKeys[keyIdx + 1];
|
if (checkedKeys < this.apiKeys.length) {
|
||||||
|
const nextKey = this.apiKeys[this.currentKeyIndex];
|
||||||
const nextKeyLabel = this.apiKeys.length > 1 ? ` (${nextKey.label})` : "";
|
const nextKeyLabel = this.apiKeys.length > 1 ? ` (${nextKey.label})` : "";
|
||||||
logger.info(`Debrid-Link${keyLabel}: kein Erfolg, wechsle zu naechstem Key${nextKeyLabel}`);
|
logger.info(`Debrid-Link${keyLabel}: kein Erfolg, wechsle zu naechstem Key${nextKeyLabel}`);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user