fsprojects / FSharp.Control.AsyncSeq

Asynchronous sequences for F#
https://fsprojects.github.io/FSharp.Control.AsyncSeq/
Other
161 stars 59 forks source link

Lack of parallelism in AsyncSeq.cache #95

Closed deneuxj closed 9 months ago

deneuxj commented 5 years ago

Description

I noticed that when multiple consumers use a cached AsyncSeq, the late ones delay reading cached items until the lead consumer receives a new item.

Repro steps

See the change to AsyncSeqTests.fs at https://github.com/fsprojects/FSharp.Control.AsyncSeq/pull/94/files

Expected behavior

Second consumer should take close to no time to read all 5 cached items

Actual behavior

Second consumer can't proceed and read cached items until the first consumer has received the next, most recent item.

Known workarounds

None

Related information

Problem observed on .net 4.5 and .net core 2.0 on master. Also observed with NuGet package 2.0.21 with .net 4.5

See https://github.com/fsprojects/FSharp.Control.AsyncSeq/pull/94 for a suggested fix and test case.

eulerfx commented 5 years ago

I think this is a sensible optimization. I haven't thought through all of the edge cases though.

abelbraaksma commented 9 months ago

Since this was merged back in Jan, 2019, this issue can now be closed? @eulerfx, @dsyme, @enricosada, @panesofglass (sorry to ping you all, perhaps you guys can add me to maintainers? I'd like to do some, ehrm, maintenance here)?

dsyme commented 9 months ago

@abelbraaksma I will ad you to maintainers :)

abelbraaksma commented 9 months ago

Thanks @dsyme!