Fix immediate automation pause, restored queue rendering and bounded disk reads; release 2.1.75
CI / verify (push) Canceled after 0s
CI / verify (push) Canceled after 0s
This commit is contained in:
1 parent
267a840853
commit
80eb878f1b
12 files changed
+168
-68
No files matched your search
+23
-1
@@ -11,6 +11,7 @@ const ClouddropUploader = require('./clouddrop-upload');
|
||||
const Semaphore = require('./semaphore');
|
||||
const Throttle = require('./throttle');
|
||||
const { runtimePerformance } = require('./performance-monitor');
|
||||
const { getUploadReadSnapshot } = require('./upload-file-io');
|
||||
const { probeFileHead } = require('./file-probe');
|
||||
const { normalizeFailureDetails } = require('./upload-diagnostics');
|
||||
const { classifyAccountFailure, selectFallbackAccount } = require('./account-rotation');
|
||||
@@ -126,7 +127,7 @@ class UploadManager extends EventEmitter {
|
||||
}
|
||||
let pending = 0;
|
||||
for (const sem of Object.values(this.semaphores)) pending += (sem && sem.pending) || 0;
|
||||
return { activeByHoster, transientErrors: this._transientErrorTotal, pending, active: this.activeJobs.size,
|
||||
return { activeByHoster, transientErrors: this._transientErrorTotal, pending, active: this.activeJobs.size, diskReads: getUploadReadSnapshot(),
|
||||
globalSlots: this.globalSemaphore ? { active: this.globalSemaphore.active, pending: this.globalSemaphore.pending, limit: this.globalSemaphore.limit } : null,
|
||||
hosterSlots: Object.fromEntries(Object.entries(this.semaphores).map(([hoster, sem]) => [hoster, { active: sem.active, pending: sem.pending, limit: sem.limit }])),
|
||||
sessionBytes: this.sessionBytes, transferredBytes: this.transferredBytes, batchStartedAt: this.startTime,
|
||||
@@ -526,6 +527,7 @@ class UploadManager extends EventEmitter {
|
||||
let finalAttempt = 0;
|
||||
|
||||
const recordFinalResult = (status, payload = {}) => {
|
||||
if (status === 'aborted' && jobAbortController.signal.reason === 'automation-pause' && !this.cancelledJobIds.has(jobId) && !batchSignal.aborted) payload = { ...payload, error: 'Warteschlange angehalten' };
|
||||
if (finalResultRecorded) return;
|
||||
finalResultRecorded = true;
|
||||
finalStatus = status;
|
||||
@@ -550,6 +552,7 @@ class UploadManager extends EventEmitter {
|
||||
};
|
||||
|
||||
const emitFinalStatus = (status, payload = {}) => {
|
||||
if (status === 'aborted' && jobAbortController.signal.reason === 'automation-pause' && !this.cancelledJobIds.has(jobId) && !batchSignal.aborted) payload = { ...payload, error: 'Warteschlange angehalten' };
|
||||
if (status === 'aborted' && this.abortController.signal.aborted) return;
|
||||
this._emitProgress(uploadId, fileName, task.hoster, { accountId: task.accountId,
|
||||
jobId,
|
||||
@@ -1575,8 +1578,27 @@ class UploadManager extends EventEmitter {
|
||||
if (!this.queueAdmissionAbortController.signal.aborted) this.queueAdmissionAbortController.abort();
|
||||
}
|
||||
|
||||
pauseImmediately() {
|
||||
this.finishAfterActive();
|
||||
for (const controller of this.jobAbortControllers.values()) {
|
||||
if (!controller.signal.aborted) controller.abort('automation-pause');
|
||||
}
|
||||
}
|
||||
|
||||
async resumeAfterActive() {
|
||||
const stoppedController = this.queueAdmissionAbortController;
|
||||
const pausedJobs = new Set([...this.jobAbortControllers].filter(([, controller]) => controller.signal.reason === 'automation-pause').map(([jobId]) => jobId));
|
||||
if (pausedJobs.size) {
|
||||
await new Promise(resolve => {
|
||||
const settled = ({ jobId }) => {
|
||||
pausedJobs.delete(jobId);
|
||||
if (pausedJobs.size) return;
|
||||
this.off('job-settled', settled);
|
||||
resolve();
|
||||
};
|
||||
this.on('job-settled', settled);
|
||||
});
|
||||
}
|
||||
await this._waitForQueueAdmissionIdle();
|
||||
if (this.queueAdmissionAbortController === stoppedController && stoppedController.signal.aborted) {
|
||||
this.queueAdmissionAbortController = new AbortController();
|
||||
|
||||
Reference in new issue
Block a user