rate-limiting

Error: connect ETIMEDOUT when scraping

≡放荡痞女 提交于 2019-12-24 20:13:12
问题 I have a function that: 1. gets an array of 3000 'id' properties from mongoDB documents from collection foo . 2. Creates a GET request for each ID to get 'resp' obj for id, and stores it in another database. router.get('/', (req, res) => { var collection = db.get().collection('foo'); var collection2 = db.get().collection('test'); collection.distinct('id', (err, idArr) => { // count: 3000+ idArr.forEach(id => { let url = 'https://externalapi.io/id=' + id request(url, (error, response, body) =>

Overcoming GitHub API Rate-Limiting from a Public Project?

假装没事ソ 提交于 2019-12-24 17:00:13
问题 I have a public repository which is an Ansible role. This Ansible role uses the GitHub API in order to get the most recent release for a given repository. I use this metadata in order to then subsequently download the latest release binary for the given project. Unfortunately, I'm hitting GitHub's API rate-limit when running my tests in Travis and occasionally on my local machine. Since this is a public-facing project, what are my options for overcoming this rate limit? I could use some kind

Only limited number of pages can be retrieved

萝らか妹 提交于 2019-12-24 00:25:14
问题 I wonder why I can't retrieve more pages of data after page 165? page number is: 165 4 image/gif page number is: 165 13 page number is: 165 3 page number is: 165 /usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html

Rate limiting a ruby file stream

梦想的初衷 提交于 2019-12-23 19:47:38
问题 I am working on a project which involves uploading flash video files to a S3 bucket from a number of geographically distributed nodes. The video files are about 2-3mb each, and we are only sending one file (per node) every ten minutes, however the bandwidth we consume needs to be rate limited to ~20k/s, as these nodes are delivering streaming media to a CDN, and due to the locations we are only able to get 512k max upload. I have been looking into the ASW-S3 gem and while it doesn't offer any

Should I rate-limit or reduce my database queries?

我的未来我决定 提交于 2019-12-23 08:56:06
问题 I'm creating a PHP script that imports some data from text files into a MySQL database. These text files are pretty large, an average file will have 10,000 lines in it each of which corresponds to a new item I want in my database. (I won't be importing files very often) I'm worried that reading a line from the file, and then doing a INSERT query, 10,000 times in a row might cause some issues. Is there a better way for me to do this? Should I perform one INSERT query with all 10,000 values? Or

Twitter API - Get number of followers of followers

ε祈祈猫儿з 提交于 2019-12-22 06:50:07
问题 I'm trying to get the number of followers of each follower for a specific account (with the goal of finding the most influencial followers). I'm using Tweepy in Python but I am running into the API rate limits and I can only get the number of followers for 5 followers before I am cut off. The account I'm looking at has about 2000 followers. Is there any way to get around this? my code snippet is ids = api.followers_ids(account_name) for id in ids: more = api.followers_ids(id) print len(more)

Servlet filter: very simple rate-limiting filter allowing bursts

守給你的承諾、 提交于 2019-12-18 17:57:19
问题 I'd like to add a very simple filter doing a per-IP rate-limit but still allowing burst, a bit like what the iptables allows to do. I don't want install the entire kitchen sink: all I need is one Filter class implementing that functionality. What would be a good data structure / algorithm allowing to do a simple "rate-limiting-but-with-short-bursts allowed"? For example I'd like to serve an HTTP error code if the user tries to do more than 'x' GET / POST per minute, but I'd still like to

Block API requests for 5 mins if API rate limit exceeds using WebApiThrottle - C# Web API

℡╲_俬逩灬. 提交于 2019-12-18 12:42:30
问题 There's a real nice library WebApiThrottle for API rate limiting in Web API. As mentioned on the Wiki page, I can rate limit the API based on the authorization token header of API call. But, how can I block the api call for the next 5 minutes if this api rate limit exceeds? Also, not that any request within next 5 minutes will reset the rate limiting exceeded time. I checked the code but couldn't find this feature. Any other way if someone can suggest? 回答1: For the time being, I'm using this

How to limit an Akka Stream to execute and send down one message only once per second?

女生的网名这么多〃 提交于 2019-12-18 05:56:14
问题 I have an Akka Stream and I want the stream to send messages down stream approximately every second. I tried two ways to solve this problem, the first way was to make the producer at the start of the stream only send messages once every second when a Continue messages comes into this actor. // When receive a Continue message in a ActorPublisher // do work then... if (totalDemand > 0) { import scala.concurrent.duration._ context.system.scheduler.scheduleOnce(1 second, self, Continue) } This

How do I limit the events currently being processed in a flatMap process?

折月煮酒 提交于 2019-12-14 03:06:04
问题 Given the following piece of code public static void main(String[] args) { long start = System.currentTimeMillis(); Flux.<Long>generate(s -> s.next(System.currentTimeMillis() - start)) .flatMap(DemoApp::delayedAction) .doOnNext(l -> System.out.println(l + " -- " + (System.currentTimeMillis() - start))) .blockLast(Duration.ofSeconds(3)); } private static Publisher<? extends Long> delayedAction(Long l) { return Mono.just(l).delayElement(Duration.ofSeconds(1)); } One can see from the output that