Simple fix for "Error in data stream"
See original GitHub issueIn case others are also encountering this error on batch downloads, here’s a simple fix.
diff --git a/packages/dukascopy-node/src/buffer-fetcher/index.ts b/packages/dukascopy-node/src/buffer-fetcher/index.ts
index fbe14ce..0818e7b 100644
--- a/packages/dukascopy-node/src/buffer-fetcher/index.ts
+++ b/packages/dukascopy-node/src/buffer-fetcher/index.ts
@@ -78,7 +78,10 @@ export class BufferFetcher {
return this.fetcherFn(url);
}
- const data = await fetch(url);
- return data.buffer();
+ while (1) {
+ const data = await fetch(url);
+ if (data.status==200) return data.buffer();
+ await wait(100); // Back-off before retry
+ }
}
}
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Diagnose issues | Datastream - Google Cloud
Configuration and connectivity errors · Go to the Organization policies page in the Google Cloud Console. · Select the Datastream - Block Public...
Read more >How To Fix: Twitch Error Loading Data - Speedify
Are you having errors loading your Twitch Streams? Are you getting Titch Error Loading Data error? Let us help you with that!
Read more >Simple Peer on data stream throws process not defined error
I am trying to open a data channel using simple peer. I send the signal using Firebase and am able to get the...
Read more >How to Resolve the Failed to Open Stream Error Message in ...
Use the error message information to locate the file or directory that is being denied. Let's start by logging into the cPanel and...
Read more >Troubleshoot Amazon Kinesis and AWS Lambda invocation ...
Lambda function errors are often caused by the following: Insufficient permissions in the Lambda function's execution role. No incoming data to ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi Leonid,
This error happens randomly. Sometimes everything goes smoothly with no errors. Other times it gets loads of 503 responses. I believe it is because Dukascopy is rate-throttling on their end. So there’s nothing much we can do about it, except to retry the fetch when it happens.
Here’s an example that I just ran. I ran it three times. Twice it ended with no errors. On the third run, it gets several 503 errors. I’ve attached an excerpt of the logs…
That’s great! Thank you very much. 😃