Skip to content

Commit 0ab55f5

Browse files
committed
Add a fallback - if packet upload fails, try again after setting the upload packet size right down
1 parent 7fb5e83 commit 0ab55f5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

js/comms.js

+6
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,12 @@ const Comms = {
297297

298298
startUpload().then(doUploadFiles, function(err) {
299299
console.warn("First attempt failed:", err);
300+
if (Const.PACKET_UPLOAD_CHUNKSIZE > 128) {
301+
// Espruino 2v25 has a 1 sec packet timeout (which isn't enough for 1kb packets if sending 20b at a time)
302+
// https://github.com/espruino/BangleApps/issues/3792#issuecomment-2804668109
303+
console.warn(`Using lower upload chunk size (${Const.PACKET_UPLOAD_CHUNKSIZE} ==> 128)`);
304+
Const.PACKET_UPLOAD_CHUNKSIZE = 128;
305+
}
300306
startUpload().then(doUploadFiles, function(err) {
301307
console.warn("Second attempt failed - bailing.", err);
302308
reject(err)

0 commit comments

Comments
 (0)