removed obsolete code

Massimo Melina committed May 17, 2025 at 11:06 UTC 84e7a0665410375c2a53eb5881c27e90080fc6ef
1 file changed +1 -17
frontend/src/uploadQueue.ts
+1 -17
@@ -51,7 +51,6 @@ window.onbeforeunload = ev => {
51 return ev.returnValue = t("Uploading") // modern browsers ignore this message
52 }
53
54 -const RETRY_UPLOAD = -1
54 let stuckSince = Infinity
55 // keep track of speed
56 let bytesSentTimestamp = Date.now()
@@ -60,10 +59,8 @@ setInterval(() => {
59 const now = Date.now()
60 const passed = (now - bytesSentTimestamp) / 1000
61 uploadState.speed = bytesSent / passed
63 - if (currentReq && now - stuckSince >= 10_000) { // this will normally cause the upload to be retried after 10+10 seconds of no progress
64 - overrideStatus = RETRY_UPLOAD // try again
62 + if (currentReq && now - stuckSince >= 10_000) // this will normally cause the upload to be retried after long time of no progress
63 currentReq.abort()
66 - }
64 bytesSent = 0 // reset counter
65 bytesSentTimestamp = now
66
@@ -110,22 +107,9 @@ export async function startUpload(toUpload: ToUpload, to: string, startingResume
107 const req = currentReq = new XMLHttpRequest()
108 const finished = pendingPromise()
109 stuckSince = Date.now()
113 - let errored = false
114 - req.onerror = () => {
115 - errored = true
116 - setTimeout(() => finished.resolve(), 2000) // retry on error, but not too often
117 - }
110 req.onloadend = async () => {
119 - if (errored && !userAborted) return
111 try {
112 currentReq = undefined
122 - if (overrideStatus === RETRY_UPLOAD) {
123 - finished.resolve()
124 - overrideStatus = 0
125 - stopLooping = true
126 - startUpload(toUpload, to, offset)
127 - return
128 - }
113 const status = overrideStatus || req.status
114 if (resuming) { // resuming requested
115 finished.resolve()