perf: several dragged items cross to another place as one tar stream; older agents get them one by one

This commit is contained in:
redtea committed 2026-10-15 22:28:46 +03:00
1 parent 6916af4236
commit 7d1996dd7d
8 files changed
+301 -72

No files matched your search

+8 -4
View File
@@ -155,14 +155,18 @@
q('.dd-ptext').textContent = 'подготовка…';
q('.dd-cancel').textContent = 'Стоп';
}
for (const p of item.paths) {
// Between places, all of them go as one stream: the first, and the rest
// as "more" (the server sends one by one to older agents).
const batch = here ? item.paths.map(p => [p]) : [item.paths];
for (const group of batch) {
const p = group[0];
if (c.stop) break;
const name = p.split('/').pop();
let r;
if (here) {
r = await from.src.op('copy', {src: p, dst: join(t.dir, name), move: isMove, conflict});
} else {
const body = {src: p, name, dir: t.dir, conflict, move: isMove};
const body = {src: p, name, dir: t.dir, conflict, move: isMove, more: group.slice(1)};
if (t.source.kind === 'ssh') { body.to = t.pane.agent.id; body.to_conn = t.pane.src.conn; }
else body.to = t.pane.agent.id;
if (from.kind === 'sshfiles') body.from_conn = from.src.conn;
@@ -170,7 +174,7 @@
r = await new MachineSource(from.agent).op('ship', body);
if (r.ok) {
c.job = r.data.job;
const pre = item.paths.length > 1 ? name + ': ' : '';
const pre = '';
r = await FV.followJob(c.job, (pr, text) => {
if (pr.total > 0 || pr.done > 0) {
q('.dd-bar').parentNode.classList.remove('wait');
@@ -182,7 +186,7 @@
}
}
if (!r.ok) { err = r.error || 'ошибка'; break; }
done++;
done += group.length;
skipped += (r.data && r.data.skipped) || 0;
}
close();