我是否需要取消订阅一个用于流式传输的侦听器才能在Kefir中结束?

时间:2016-01-25 18:57:22

标签: kefir.js

我正在离开BaconJS,这不是问题,因为你可以在订阅者中返回// if (b != 0) // if (a > b) // cout << a << endl; 取消订阅。在Kefir中,取消订阅是更多的样板,因此自然的问题是---对于流结束,您是否需要取消订阅监听器(也称为回调)或者Kefir是否自动为您处理?

Bacon.noMore

1 个答案:

答案 0 :(得分:1)

根据图书馆作者的说法,答案是“否”:https://github.com/rpominov/kefir/issues/182

  

是的,你不需要。所有听众都会自动删除。此外,当您订阅已结束的流时,它是一个noop。

     

顺便说一下,因为你可以通过使用take / takeWhile / takeUntilBy / etc限制流来避免手动取消订阅。

2016-01-25T22:21:15.907-0600 I SHARDING [conn142] moveChunk data transfer progress: { active: true, ns: "music.fav_artist_score", from: "rs1/MONGODB01-SRV:27017,MONGODB05-SRV:27017", min: { _id.u: -9159729253516193447 }, max: { _id.u: -9157438072680830290 }, shardKeyPattern: { _id.u: "hashed" }, state: "clone", counts: { cloned: 128, clonedBytes: 12419, catchup: 0, steady: 0 }, ok: 1.0 } my mem used: 0
2016-01-25T22:21:16.932-0600 I SHARDING [conn142] moveChunk data transfer progress: { active: true, ns: "music.fav_artist_score", from: "rs1/MONGODB01-SRV:27017,MONGODB05-SRV:27017", min: { _id.u: -9159729253516193447 }, max: { _id.u: -9157438072680830290 }, shardKeyPattern: { _id.u: "hashed" }, state: "clone", counts: { cloned: 128, clonedBytes: 12419, catchup: 0, steady: 0 }, ok: 1.0 } my mem used: 0
2016-01-25T22:21:17.957-0600 I SHARDING [conn142] moveChunk data transfer progress: { active: true, ns: "music.fav_artist_score", from: "rs1/MONGODB01-SRV:27017,MONGODB05-SRV:27017", min: { _id.u: -9159729253516193447 }, max: { _id.u: -9157438072680830290 }, shardKeyPattern: { _id.u: "hashed" }, state: "clone", counts: { cloned: 128, clonedBytes: 12419, catchup: 0, steady: 0 }, ok: 1.0 } my mem used: 0