Compare commits

..

No commits in common. "c462f6bef53fdbcc2c1ae3a116764d59aea8c8df" and "e6bad780ee1e0c8713bf35cc0e9f0decfb806543" have entirely different histories.

2 changed files with 9 additions and 16 deletions

View File

@ -35,7 +35,6 @@ class UploadManager extends EventEmitter {
this.cancelledJobIds = new Set();
this.sessionBytes = 0;
this.lastStartTime = {}; // hoster -> timestamp of last upload start
this.intervalLocks = {}; // hoster -> Promise chain for serialized interval waits
this.globalThrottle = null;
}
@ -545,20 +544,14 @@ class UploadManager extends EventEmitter {
});
}
_waitForInterval(hoster, intervalMs, signal) {
// Serialize interval waits per hoster so concurrent jobs queue up properly
const prev = this.intervalLocks[hoster] || Promise.resolve();
const next = prev.then(async () => {
const now = Date.now();
const last = this.lastStartTime[hoster] || 0;
const elapsed = now - last;
if (elapsed < intervalMs) {
await this._sleep(intervalMs - elapsed, signal);
}
this.lastStartTime[hoster] = Date.now();
});
this.intervalLocks[hoster] = next.catch(() => {});
return next;
async _waitForInterval(hoster, intervalMs, signal) {
const now = Date.now();
const last = this.lastStartTime[hoster] || 0;
const elapsed = now - last;
if (elapsed < intervalMs) {
await this._sleep(intervalMs - elapsed, signal);
}
this.lastStartTime[hoster] = Date.now();
}
cancelJobs(jobIds) {

View File

@ -1,6 +1,6 @@
{
"name": "multi-hoster-uploader",
"version": "1.6.6",
"version": "1.6.5",
"description": "Upload files to doodstream, voe, vidmoly, byse simultaneously",
"main": "main.js",
"scripts": {