Use mutex library instead of repeatedly chaining promises
Summary: I noticed that after a long-running flipper session, 11% of the memory was composed of millions of tiny PromiseReaction records (https://github.com/domenic/promises-unwrapping#promisereaction-records). It seems this method of chaining promises meant that it was forming a linked list of these from the most recent, back to the very first invocation. Instead of using a home-rolled lock, I'm replacing it with an actual library. Haven't verified the fix, but this seems like a better approach regardless. Reviewed By: passy Differential Revision: D15853570 fbshipit-source-id: 1626d9f25cba809794b13ee920bdec2cd1d4b874
This commit is contained in:
committed by
Facebook Github Bot
parent
347487a328
commit
ef1eb41dba
46
flow-typed/npm/async-mutex_vx.x.x.js
vendored
Normal file
46
flow-typed/npm/async-mutex_vx.x.x.js
vendored
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
// flow-typed signature: 3f26bdb86dbdfe57e7bf6c11d85e98e4
|
||||||
|
// flow-typed version: <<STUB>>/async-mutex_v0.1.3/flow_v0.100.0
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is an autogenerated libdef stub for:
|
||||||
|
*
|
||||||
|
* 'async-mutex'
|
||||||
|
*
|
||||||
|
* Fill this stub out by replacing all the `any` types.
|
||||||
|
*
|
||||||
|
* Once filled out, we encourage you to share your work with the
|
||||||
|
* community by sending a pull request to:
|
||||||
|
* https://github.com/flowtype/flow-typed
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare module 'async-mutex' {
|
||||||
|
declare module.exports: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* We include stubs for each file inside this npm package in case you need to
|
||||||
|
* require those files directly. Feel free to delete any files that aren't
|
||||||
|
* needed.
|
||||||
|
*/
|
||||||
|
declare module 'async-mutex/lib/index' {
|
||||||
|
declare module.exports: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'async-mutex/lib/Mutex' {
|
||||||
|
declare module.exports: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'async-mutex/lib/MutexInterface' {
|
||||||
|
declare module.exports: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filename aliases
|
||||||
|
declare module 'async-mutex/lib/index.js' {
|
||||||
|
declare module.exports: $Exports<'async-mutex/lib/index'>;
|
||||||
|
}
|
||||||
|
declare module 'async-mutex/lib/Mutex.js' {
|
||||||
|
declare module.exports: $Exports<'async-mutex/lib/Mutex'>;
|
||||||
|
}
|
||||||
|
declare module 'async-mutex/lib/MutexInterface.js' {
|
||||||
|
declare module.exports: $Exports<'async-mutex/lib/MutexInterface'>;
|
||||||
|
}
|
||||||
@@ -74,6 +74,7 @@
|
|||||||
"JSONStream": "^1.3.1",
|
"JSONStream": "^1.3.1",
|
||||||
"adbkit-fb": "2.10.1",
|
"adbkit-fb": "2.10.1",
|
||||||
"ansi-to-html": "^0.6.3",
|
"ansi-to-html": "^0.6.3",
|
||||||
|
"async-mutex": "^0.1.3",
|
||||||
"chalk": "^2.3.0",
|
"chalk": "^2.3.0",
|
||||||
"child-process-es6-promise": "^1.2.1",
|
"child-process-es6-promise": "^1.2.1",
|
||||||
"codemirror": "^5.25.0",
|
"codemirror": "^5.25.0",
|
||||||
|
|||||||
@@ -1494,6 +1494,11 @@ async-limiter@^1.0.0, async-limiter@~1.0.0:
|
|||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.0.tgz#78faed8c3d074ab81f22b4e985d79e8738f720f8"
|
resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.0.tgz#78faed8c3d074ab81f22b4e985d79e8738f720f8"
|
||||||
|
|
||||||
|
async-mutex@^0.1.3:
|
||||||
|
version "0.1.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/async-mutex/-/async-mutex-0.1.3.tgz#0aad2112369795ab3f17e33744556d2ecf547566"
|
||||||
|
integrity sha1-Cq0hEjaXlas/F+M3RFVtLs9UdWY=
|
||||||
|
|
||||||
async@^2.5.0:
|
async@^2.5.0:
|
||||||
version "2.6.1"
|
version "2.6.1"
|
||||||
resolved "https://registry.yarnpkg.com/async/-/async-2.6.1.tgz#b245a23ca71930044ec53fa46aa00a3e87c6a610"
|
resolved "https://registry.yarnpkg.com/async/-/async-2.6.1.tgz#b245a23ca71930044ec53fa46aa00a3e87c6a610"
|
||||||
|
|||||||
Reference in New Issue
Block a user