I would like to be able to throttle calls getPagerank()to unity per second. I tried different things, but I can not get it to work.
getPagerank()
var pagerank = require('pagerank'); var _ = require('highland'); var urls = [ 'google.com', 'yahoo.com', 'bing.com' ]; var getPagerank = _.wrapCallback(pagerank); // I want to throttle calls to getPagerank to 1/sec var pageRanks = _(urls) .map(getPagerank) .merge(); pageRanks.toArray(function(arr) { console.log(arr); });
you can use .ratelimit()
.ratelimit()
eg. this limits the flow to processing one element of the array in one second.
var _ = require('highland'); _([1,2,3,4]).ratelimit(1, 1000).map(function(x){ return String(x); }) .pipe(process.stdout);
Source: https://habr.com/ru/post/1607683/More articles:Parallel and Distributed Matrix Multiplication Algorithms - algorithmCan't get the ionic app to work (under development) if you turn off Wi-Fi - cordovaBash get column number from column name - bashHow to get seed job name inside Jenksin Job DSL script? - jenkinsformat date from "MMM dd, yyyy HH: mm: ss a" to "MM.dd - java"tramp" does not work when installing the estate on ubuntu 14.04 - phpUnsigned char overflow with subtraction - cGedmo loggable works but doesn't save username - logginghow to link to title ActionBar View on Lollipop - androidfindViewById returns null for action_bar_title - androidAll Articles