Quantcast
Channel: dns.resolveCname fails when there are large amounts of CNAMEs to be resolved - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Answer by Alexandru Olaru for dns.resolveCname fails when there are large amounts of CNAMEs to be resolved

$
0
0

ESERVFAIL- The application queries for api.example.com, there is a SERVFAIL error thrown back and the call fails.

Promise.all will catch (stop the execution) if at least one of the async functions is throwing an error. So you can't use Promise all in this case, and for 10000 async calls it is a bad practice, you can easily dump out all your memory.

One way to solve your problem is implement a parallel limited queue which will resolve the errors and the results, and then you just can manage to output the results in a proper manner.

One library that I found that implements the limited queue is cwait

From their documentation:

import * as Promise from 'bluebird';
import {TaskQueue} from 'cwait';

/** Queue allowing 3 concurrent function calls. */
var queue = new TaskQueue(Promise, 3);

Promise.map(list, download); // Download all listed files simultaneously.

Promise.map(list, queue.wrap(download))); // Download 3 files at a time.

Viewing all articles
Browse latest Browse all 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>