-
-
Notifications
You must be signed in to change notification settings - Fork 239
Closed
Description
I'm using this library to de-reference a JSON API spec with hundreds of references.
await jsonSchemaRefParser.dereference(
"https://raw.githubusercontent.com/octokit/routes/v21.0.4/openapi/api.github.com/index.json"
);
I see random request errors which I could workaround quite easily by adding a simple retry feature in lib/resolvers/http.js
- req.on("error", reject)
+ let retries = 3
+ req.on("error", error => {
+ if (!--retries) {
+ return reject(error);
+ }
+
+ console.log(`retrying GET ${u.href} (${3 - retries}/3)`);
+
+ return get(u, httpOptions).then(resolve, reject);
+ });
Instead of hardcoding it, it would be simple enough to add an option such as resolve.http.retries
.
Would you accept a PR to add such an option?
Metadata
Metadata
Assignees
Labels
No labels