Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Error: socket hang up" when downloading too fast #71

Open
matgoebl opened this issue Sep 14, 2024 · 0 comments
Open

"Error: socket hang up" when downloading too fast #71

matgoebl opened this issue Sep 14, 2024 · 0 comments

Comments

@matgoebl
Copy link

When doing an intial start with ca. 40 messages including ca 8 attachments, I get "Error: socket hang up" when downloading too fast.

Waiting 500 ms in downloadFile() helps:

--- a/elternportal.js
+++ b/elternportal.js
@@ -59,6 +59,7 @@ function haveOutbound() {
 
 // Downloads from file.url, setting file.filename and file.content.
 async function downloadFile(file, options) {
+  await new Promise(resolve => setTimeout(resolve, 500)); // I get "Error: socket hang up" when downloading too fast^M
   // Collect buffers and use Buffer.concat() to avoid chunk size arithmetics.
   let buffers = [];
   // It seems attachment downloads don't need to be throttled.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant