Page MenuHomePhabricator

Fix a bug which prevented Conduit futures from having parallelism limited effectively
ClosedPublic

Authored by epriestley on Oct 12 2017, 7:18 PM.
Tags
None
Referenced Files
F14812411: D18704.diff
Mon, Jan 27, 7:08 AM
Unknown Object (File)
Fri, Jan 24, 10:41 PM
Unknown Object (File)
Fri, Jan 24, 10:41 PM
Unknown Object (File)
Fri, Jan 24, 10:41 PM
Unknown Object (File)
Thu, Jan 23, 8:13 PM
Unknown Object (File)
Wed, Jan 22, 6:03 PM
Unknown Object (File)
Tue, Jan 21, 3:13 PM
Unknown Object (File)
Tue, Jan 21, 11:14 AM
Subscribers
None

Details

Summary

Ref T13008. Currently, ConduitClient calls isReady() on futures before returning them.

This is very old, and wrong: it makes the future activate and start working. In the case of ConduitFutures, which wrap HTTPFutures, it causes them to make an HTTP request.

Instead, return dormant futures without calling isReady(). Then the construct used by ArcanistFileUploader and many other pieces of code will limit parallelism properly:

$iterator = id(new FutureIterator($futures))
  ->limit(4);
foreach ($iterator as $future) {
 // ...
}

Also, fix up the --trace profiler integration so we get a log when the future actually starts, not when we create it.

Test Plan

Ran arc upload --trace ... with a bunch of files, fiddling with the limit(X). Saw 4 (default) and 1 properly throttle requests. Saw 200 unthrottle requests.

Diff Detail

Repository
rPHU libphutil
Branch
post6
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 18673
Build 25156: Run Core Tests
Build 25155: arc lint + arc unit