Compare commits
No commits in common. "c696b0cb0ecc9af34d20f7b32fccaac685fb6e10" and "22869df8a5fa85f781fb455a9bfeaebc86df4c5e" have entirely different histories.
c696b0cb0e
...
22869df8a5
@ -413,20 +413,12 @@ async function uploadFile(hosterName, filePath, apiKey, onProgress, signal, thro
|
|||||||
throw new Error(payload.msg || payload.message || `Upload zu ${hosterName} wurde vom Server abgelehnt.`);
|
throw new Error(payload.msg || payload.message || `Upload zu ${hosterName} wurde vom Server abgelehnt.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Avoid throwing a bare "OK" / "SUCCESS" as the error message — that happens
|
|
||||||
// when the server says "msg: OK" but ships no file_code anywhere we know
|
|
||||||
// about, typically an API change. Surface the full (trimmed) payload so
|
|
||||||
// future logs actually show what the server returned.
|
|
||||||
const msg = String(payload.msg || payload.message || '').trim();
|
|
||||||
const isOkishNoPayload = /^(ok|success|done|accepted)$/i.test(msg);
|
|
||||||
if (isOkishNoPayload || !msg) {
|
|
||||||
const snippet = JSON.stringify(payload).slice(0, 400);
|
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Upload zu ${hosterName} lieferte keine file_code-Antwort (Payload: ${snippet})`
|
payload.msg
|
||||||
|
|| payload.message
|
||||||
|
|| `Upload zu ${hosterName} lieferte keine verwendbaren Dateidaten zurueck.`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
throw new Error(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
uploadFile,
|
uploadFile,
|
||||||
|
|||||||
@ -56,38 +56,11 @@ class UploadManager extends EventEmitter {
|
|||||||
this.emit('rot-log', { ts: Date.now(), event, ...data });
|
this.emit('rot-log', { ts: Date.now(), event, ...data });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transient network errors — the account is fine, the network or the
|
|
||||||
// hoster's own backend hiccuped. Retrying on the SAME account is the right
|
|
||||||
// move; marking it failed would wrongly poison the fallback chain. If all
|
|
||||||
// retries on the current account still hit this class of error, we bail
|
|
||||||
// out for this file without blacklisting the account, so other jobs in the
|
|
||||||
// batch still get a fresh chance on it.
|
|
||||||
_isTransientNetworkError(err) {
|
|
||||||
if (!err || !err.message) return false;
|
|
||||||
const m = String(err.message);
|
|
||||||
const TRANSIENT = [
|
|
||||||
/ENOTFOUND/i,
|
|
||||||
/ECONNRESET/i,
|
|
||||||
/ECONNREFUSED/i,
|
|
||||||
/ETIMEDOUT/i,
|
|
||||||
/EAI_AGAIN/i,
|
|
||||||
/EHOSTUNREACH/i,
|
|
||||||
/ENETUNREACH/i,
|
|
||||||
/EPIPE/i,
|
|
||||||
/socket hang up/i,
|
|
||||||
/network (error|failure|problem)/i,
|
|
||||||
/dns (lookup|error|failed)/i,
|
|
||||||
/getaddrinfo/i,
|
|
||||||
/fetch failed/i,
|
|
||||||
/\bconnect (ETIMEDOUT|ECONN)/i
|
|
||||||
];
|
|
||||||
return TRANSIENT.some(p => p.test(m));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Error classes that mean "this account is the problem, retrying on it won't
|
// Error classes that mean "this account is the problem, retrying on it won't
|
||||||
// help" — we skip the remaining retries and go straight to the fallback
|
// help" — we skip the remaining retries and go straight to the fallback
|
||||||
// account. Keeps single runs fast when an account is rate-limited, banned,
|
// account. Keeps single runs fast when an account is rate-limited, banned,
|
||||||
// or out of quota.
|
// or out of quota. Transient network issues still go through the normal
|
||||||
|
// retry loop on the same account.
|
||||||
_shouldSkipRetryOnAccountError(err) {
|
_shouldSkipRetryOnAccountError(err) {
|
||||||
if (!err || !err.message) return false;
|
if (!err || !err.message) return false;
|
||||||
const m = String(err.message);
|
const m = String(err.message);
|
||||||
@ -569,19 +542,6 @@ class UploadManager extends EventEmitter {
|
|||||||
hoster: task.hoster, fileName, accountId: task.accountId,
|
hoster: task.hoster, fileName, accountId: task.accountId,
|
||||||
lastError: lastError ? lastError.message : null
|
lastError: lastError ? lastError.message : null
|
||||||
});
|
});
|
||||||
// If the reason for failure was a transient network error we do NOT
|
|
||||||
// blacklist the account. Other jobs on the same account in this batch
|
|
||||||
// can still try fresh. This file just errors out for now.
|
|
||||||
if (this._isTransientNetworkError(lastError)) {
|
|
||||||
this._rotLog('skip-rotation-transient', {
|
|
||||||
hoster: task.hoster, fileName, accountId: task.accountId,
|
|
||||||
lastError: lastError ? lastError.message : null
|
|
||||||
});
|
|
||||||
const error = lastError.message || 'Netzwerkfehler';
|
|
||||||
emitFinalStatus('error', { error });
|
|
||||||
recordFinalResult('error', { error });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
while (task.accountId) {
|
while (task.accountId) {
|
||||||
if (signal.aborted || this.stopAfterActive) break;
|
if (signal.aborted || this.stopAfterActive) break;
|
||||||
const alreadyMarked = this._failedAccounts.has(task.hoster + ':' + task.accountId);
|
const alreadyMarked = this._failedAccounts.has(task.hoster + ':' + task.accountId);
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "multi-hoster-uploader",
|
"name": "multi-hoster-uploader",
|
||||||
"version": "3.0.9",
|
"version": "3.0.8",
|
||||||
"description": "Upload files to doodstream, voe, vidmoly, byse simultaneously",
|
"description": "Upload files to doodstream, voe, vidmoly, byse simultaneously",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user