Compare commits
No commits in common. "79fe3037eb7b90a5774d73923d5c81603a30c9fa" and "b0b86e5016b8ec02d2c3a6e9a464cc3ae8b05748" have entirely different histories.
79fe3037eb
...
b0b86e5016
@ -9,7 +9,7 @@ const DoodstreamUploader = require('./doodstream-upload');
|
|||||||
const ClouddropUploader = require('./clouddrop-upload');
|
const ClouddropUploader = require('./clouddrop-upload');
|
||||||
const Semaphore = require('./semaphore');
|
const Semaphore = require('./semaphore');
|
||||||
const Throttle = require('./throttle');
|
const Throttle = require('./throttle');
|
||||||
const { probeFileHead } = require('./file-probe');
|
const { probeFileHead, summarizeFileStat } = require('./file-probe');
|
||||||
|
|
||||||
const DEFAULT_SETTINGS = {
|
const DEFAULT_SETTINGS = {
|
||||||
retries: 3,
|
retries: 3,
|
||||||
@ -435,25 +435,21 @@ class UploadManager extends EventEmitter {
|
|||||||
maxAttempts
|
maxAttempts
|
||||||
});
|
});
|
||||||
|
|
||||||
// Acquire hoster semaphore first so jobs waiting for a hoster slot
|
const fileStat = summarizeFileStat(task.file);
|
||||||
// don't waste global slots (prevents underutilization)
|
const fileProbe = await probeFileHead(task.file, 64).catch((err) => ({ ok: false, error: err.message, kind: 'unreadable' }));
|
||||||
await hosterSemaphore.acquire(signal);
|
|
||||||
hosterSlotAcquired = true;
|
|
||||||
|
|
||||||
let fileProbe = null;
|
|
||||||
try {
|
|
||||||
fileProbe = await probeFileHead(task.file, 64);
|
|
||||||
} catch (err) {
|
|
||||||
fileProbe = { ok: false, error: err && err.message, kind: 'unreadable' };
|
|
||||||
}
|
|
||||||
this._rotLog('upload-start', {
|
this._rotLog('upload-start', {
|
||||||
jobId, hoster: task.hoster, accountId: task.accountId, fileName,
|
jobId, hoster: task.hoster, accountId: task.accountId, fileName,
|
||||||
fileSize,
|
fileSize: fileStat.size, fileMtime: fileStat.mtime,
|
||||||
detectedKind: fileProbe && fileProbe.kind ? fileProbe.kind : 'unknown',
|
detectedKind: fileProbe && fileProbe.kind ? fileProbe.kind : 'unknown',
|
||||||
isVideoLike: !!(fileProbe && fileProbe.isVideoLike),
|
isVideoLike: !!(fileProbe && fileProbe.isVideoLike),
|
||||||
headHex: fileProbe && fileProbe.headHex ? fileProbe.headHex.slice(0, 32) : null
|
headHex: fileProbe && fileProbe.headHex ? fileProbe.headHex.slice(0, 32) : null
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Acquire hoster semaphore first so jobs waiting for a hoster slot
|
||||||
|
// don't waste global slots (prevents underutilization)
|
||||||
|
await hosterSemaphore.acquire(signal);
|
||||||
|
hosterSlotAcquired = true;
|
||||||
|
|
||||||
if (globalSemaphore) {
|
if (globalSemaphore) {
|
||||||
await globalSemaphore.acquire(signal);
|
await globalSemaphore.acquire(signal);
|
||||||
globalSlotAcquired = true;
|
globalSlotAcquired = true;
|
||||||
|
|||||||
11
main.js
11
main.js
@ -1445,15 +1445,6 @@ ipcMain.handle('start-upload', (_event, payload) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const ROT_LOG_RENDERER_EVENTS = new Set([
|
|
||||||
'switchAccount',
|
|
||||||
'pre-job-swap',
|
|
||||||
'try-alternate-after-fail',
|
|
||||||
'mark-failed',
|
|
||||||
'rotation-end',
|
|
||||||
'doodstream-via-api',
|
|
||||||
'doodstream-via-web'
|
|
||||||
]);
|
|
||||||
uploadManager.on('rot-log', (entry) => {
|
uploadManager.on('rot-log', (entry) => {
|
||||||
const { ts, event, ...rest } = entry;
|
const { ts, event, ...rest } = entry;
|
||||||
const pairs = Object.entries(rest)
|
const pairs = Object.entries(rest)
|
||||||
@ -1463,7 +1454,7 @@ ipcMain.handle('start-upload', (_event, payload) => {
|
|||||||
if (entry.jobId) {
|
if (entry.jobId) {
|
||||||
_appendJobLog(entry.jobId, { ts: ts || Date.now(), kind: 'rot', event, ...rest });
|
_appendJobLog(entry.jobId, { ts: ts || Date.now(), kind: 'rot', event, ...rest });
|
||||||
}
|
}
|
||||||
if (mainWindow && !mainWindow.isDestroyed() && ROT_LOG_RENDERER_EVENTS.has(event)) {
|
if (mainWindow && !mainWindow.isDestroyed()) {
|
||||||
mainWindow.webContents.send('account-rotation-log', entry);
|
mainWindow.webContents.send('account-rotation-log', entry);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "multi-hoster-uploader",
|
"name": "multi-hoster-uploader",
|
||||||
"version": "3.3.45",
|
"version": "3.3.44",
|
||||||
"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