From ceb9ce36ae9d4c688c4682ca752e77a48d12f285 Mon Sep 17 00:00:00 2001 From: Ovidiu Viorel Iepure Date: Fri, 14 Oct 2016 12:06:30 -0700 Subject: [PATCH] Rate limit HasteMap Reviewed By: davidaurelio Differential Revision: D4021676 fbshipit-source-id: 383f9a17ac8ede72f41939192ec25a6277a36864 --- package.json | 1 + .../react-packager/src/node-haste/DependencyGraph/HasteMap.js | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/package.json b/package.json index b88545ca7..4619f1677 100644 --- a/package.json +++ b/package.json @@ -195,6 +195,7 @@ "source-map": "^0.5.6", "stacktrace-parser": "^0.1.3", "temp": "0.8.3", + "throat": "^3.0.0", "uglify-js": "^2.6.2", "whatwg-fetch": "^1.0.0", "wordwrap": "^1.0.0", diff --git a/packager/react-packager/src/node-haste/DependencyGraph/HasteMap.js b/packager/react-packager/src/node-haste/DependencyGraph/HasteMap.js index 7efbeb42a..172e0493d 100644 --- a/packager/react-packager/src/node-haste/DependencyGraph/HasteMap.js +++ b/packager/react-packager/src/node-haste/DependencyGraph/HasteMap.js @@ -12,6 +12,7 @@ const EventEmitter = require('events'); const path = require('../fastpath'); const getPlatformExtension = require('../lib/getPlatformExtension'); +const throat = require('throat'); const GENERIC_PLATFORM = 'generic'; const NATIVE_PLATFORM = 'native'; @@ -33,6 +34,9 @@ class HasteMap extends EventEmitter { this._preferNativePlatform = preferNativePlatform; this._helpers = helpers; this._platforms = platforms; + + this._processHastePackage = throat(1, this._processHastePackage.bind(this)); + this._processHasteModule = throat(1, this._processHasteModule.bind(this)); } build() {