New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Supply.throttle should return a Supply of pairs #5573
Comments
From liukan@360.cnSupply.throttle returns a Supply of promises, which in practice may be inadequate. It should return a Supply of pairs, keys being the elements, value being the corresponding Promises. Consider the following senario, my @a = 1 .. 10; my $s = Supply.from-list( |@a ).throttle: 5, -> $i { &$c( $i ) }; as is, we have no way of knowing which element's corresponding promise failed, not having implemented the logic inside $c. To circumvent this limitation, one could perceivably do the following, which is combersome. my $s2 = Supply.from-list( |@a ).throttle: 5, -> $i { $i => start { &$c( $i ) } }; Furthermore, throttle should provide a timeout logic. Without it, to implement something equivalent, which is just convoluted. my $s3 = Supply.from-list( |@a ).throttle: 5, -> $i { The code is also not stable when the resulting supply is tapped. when the thrott - kan [15:01] <kanl> Supply . throttle returns a supply of promises. How does each promise correspond to the original items? e.g. my $s = Supply.from-list( |@a ).throttle: 3, -> $v { do-something-with( $a ) }; $s.tap: -> $v { how-to-figure-out-relation-here() } - kan |
@coke - Status changed from 'new' to 'open' |
Migrated from rt.perl.org#128937 (status was 'open')
Searchable as RT128937$
The text was updated successfully, but these errors were encountered: