Page MenuHomePhabricator

Introduce "FuturePool" to make it easier to manage an ongoing pool of futures
ClosedPublic

Authored by epriestley on Apr 3 2020, 6:56 PM.
Tags
None
Referenced Files
F14087083: D21053.diff
Sat, Nov 23, 6:55 PM
Unknown Object (File)
Thu, Nov 21, 5:14 PM
Unknown Object (File)
Wed, Nov 13, 1:37 PM
Unknown Object (File)
Fri, Nov 1, 2:56 PM
Unknown Object (File)
Sun, Oct 27, 10:18 AM
Unknown Object (File)
Oct 22 2024, 10:38 PM
Unknown Object (File)
Oct 22 2024, 6:34 PM
Unknown Object (File)
Oct 11 2024, 3:04 AM
Subscribers
None

Details

Summary

Ref T11968. "FutureIterator" recently became non-rewindable, and starting a Future twice is now an error.

This complicates a handful of use cases where a mostly-constant pool of futures is maintained over a long period of time, notably in daemon overseers and repository pull daemons.

They previously relied on being able to do "new FutureIterator($futures)" to continue resolution of a list of futures from any state. This no longer works quite like it used to, since Futures generally may not belong to more than one iterator now (and this property is desirable).

Introduce "FuturePool", which maintains exactly one iterator but manages the small amount of glue around adding and removing Futures from it, destroying it if the pool empties, and rebuilding it if the pool fills.

Test Plan

See next change, which makes use of this.

Diff Detail

Repository
rARC Arcanist
Lint
Lint Not Applicable
Unit
Tests Not Applicable