fix: XHR + cache-busting ?_=Date.now() чтобы исключить connection reuse
Deploy drhider / validate (push) Waiting to run
Deploy drhider / validate (push) Waiting to run
This commit is contained in:
@@ -170,9 +170,13 @@ async function uploadFiles() {
|
||||
try {
|
||||
const t0 = performance.now();
|
||||
await new Promise((resolve, reject) => {
|
||||
const fd = new FormData();
|
||||
fd.append('files', f, f.name);
|
||||
if (currentSid) fd.append('session', currentSid);
|
||||
const url = '/api/upload?_=' + Date.now();
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open('POST', '/api/upload');
|
||||
xhr.timeout = 30000; // 30 сек — не висеть бесконечно
|
||||
xhr.open('POST', url);
|
||||
xhr.timeout = 30000;
|
||||
xhr.upload.onprogress = function(e) {
|
||||
if (e.lengthComputable) {
|
||||
const pct = Math.round(e.loaded / e.total * 100);
|
||||
@@ -197,9 +201,6 @@ async function uploadFiles() {
|
||||
};
|
||||
xhr.onerror = function() { reject(new Error('Сеть')); };
|
||||
xhr.ontimeout = function() { reject(new Error('Таймаут 30с')); };
|
||||
const fd = new FormData();
|
||||
fd.append('files', f, f.name);
|
||||
if (currentSid) fd.append('session', currentSid);
|
||||
xhr.send(fd);
|
||||
});
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user