← 返回刚才阅读的位置

知识卡片

普通读书笔记卡 · 4545.g.3.c.1

合流在全部生产者结束后关闭

理解等级:中级

Fan-In把多个同类型输入通道转发到一个输出,便于统一消费。每个输入有转发者,等待所有转发者完成后由一个协调者关闭输出,避免还有发送者时提前关闭。输出消费过慢会通过阻塞产生背压;若接收者提前退出,转发也必须有停止途径。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • Cloud Native Patterns · 查看原书依据

      For each channel in sources, Funnel starts a separate goroutine that reads values from its assigned source and forwards them to dest, a single output channel shared by all of the goroutines. Note the use of a sync.WaitGroup, which is used in a separate goroutine to close the dest channel after all of the sources

    参考来源

    - 位置:《Cloud Native Go》第04章《Cloud Native Patterns》(来源项目book-sources;源文件:extracted/Cloud Native Go (Matthew A. Titmus)/_epub-src/OEBPS/ch04.xhtml) - 结论依据:Fan-In把多个同类型输入通道转发到一个输出,便于统一消费。原文相应定义、示例或限制为此结论提供依据;补充纠错与版本边界在正文就近标明。 - 原始内容:For each channel in sources, Funnel starts a separate goroutine that reads values from its assigned source and forwards them to dest, a single output channel shared by all of the goroutines. Note the use of a sync.WaitGroup, which is used in a separate goroutine to close the dest channel after all of the sources