Skip to content

Commit 66898bb

Browse files
remove the silencing of the flush
1 parent 6970397 commit 66898bb

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"@noisytransfer/errors": "^0.2.2",
6565
"@noisytransfer/noisyauth": "^0.2.4",
6666
"@noisytransfer/noisystream": "^0.2.5",
67-
"@noisytransfer/transport": "^0.2.3",
67+
"@noisytransfer/transport": "^0.2.4",
6868
"@noisytransfer/util": "^0.2.2",
6969
"commander": "^12.1.0",
7070
"micromatch": "^4.0.7",

src/commands/send.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,18 +85,21 @@ export async function run(paths, opts, ctx = {}) {
8585
getLogger().debug(`send: tarball name set to ${sendNameHint}`);
8686
}
8787
// Progress UI
88-
const t0 = Date.now();
88+
let startedAt = null;
8989
let lastTick = 0;
9090
function onProgress(sent, total) {
9191
getLogger().debug(`OnProgress: sent=${sent} total=${total}`);
9292
const now = Date.now();
93+
if (startedAt == null && sent > 0) {
94+
startedAt = now;
95+
}
9396
if (now - lastTick < 120 && sent !== total) return;
9497
lastTick = now;
9598
if (process.stderr.isTTY) {
9699
const msg = formatProgressLine({
97100
doneBytes: sent,
98101
totalBytes: total,
99-
startedAt: t0,
102+
startedAt: startedAt ?? now,
100103
});
101104
process.stderr.write(`\r${msg}`);
102105
} else {

src/transfer/default.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,11 @@ import { confirmSAS } from "../core/sas-confirm.js";
2121
const SEND_HIGH_WATER = Number(process.env.NT_SEND_HIGH_WATER || (1 * 1024 * 1024));
2222

2323
async function applyBackpressure(rtc) {
24-
try {
2524
if (typeof rtc?.bufferedAmount === "number" && typeof rtc?.flush === "function") {
2625
if (rtc.bufferedAmount > SEND_HIGH_WATER) {
2726
await rtc.flush();
2827
}
2928
}
30-
} catch {}
3129
}
3230

3331

@@ -203,13 +201,6 @@ export async function defaultSend(
203201
const ok = sent === total;
204202
rtc.send(packStreamFin({ sessionId, ok }));
205203
await applyBackpressure(rtc);
206-
207-
// 4) Flush if supported (mirrors tests' "flush" semantics)
208-
if (typeof rtc.flush === "function") {
209-
try {
210-
await rtc.flush();
211-
} catch {}
212-
}
213204
}
214205

215206
export async function defaultRecv(rtc, { sessionId, sink, onProgress, assumeYes = false }) {

0 commit comments

Comments
 (0)