Conversation
from.go
Outdated
|
|
||
| // FromChannelWithTimeout initializes a linq query with a passed channel, | ||
| // but stops iterating either when the channel is closed or when the timeout elapses. | ||
| func FromChannelWithTimeout[T any](source <-chan T, timeout time.Duration) Query { |
There was a problem hiding this comment.
Why don't we just do ctx instead? That way we support any form of cancellation not just time.
There was a problem hiding this comment.
I added FromChannelWithContext method and kept FromChannelWithTimeout for convenience, but I am not sure it is really needed. wdyt?
bd0b09e to
ae7bc58
Compare
ee46563 to
1e037ec
Compare
1e037ec to
771eb7c
Compare
|
I think we should just remove the Timeout one. It's fairly easy to implement given ctx signature is offered on another method. |
Yes, very much agree, had a similar feeling. UPDATE: Though we can slightly change |
|
I think it's fine to just have the ctx version. Typically if someone has a deadline it applies to the whole thing not when we start iterating. |
resolves #93