简体   繁体   English

在RxSwift中一次仅执行一次订阅方法

[英]Execute subscribe method only once at the time in RxSwift

I have a PublishObject object, which is feed by coming data (approximately 16 times per second). 我有一个PublishObject对象,该对象由即将到来的数据(每秒约16次)提供。 When objects coming so quickly, that can be a situation, when one is still processing, but the new one is ready to use. 当物体飞速到达时,可能是一种情况,即物体仍在处理中,但是新的物体可以使用了。 Is it a way to block executing another processing, when the earlier doesn't end his job? 当前者没有结束工作时,这是一种阻止执行其他处理的方法吗?

This is called backpressure, and there are different strategies to handle it. 这称为背压,并且有不同的应对策略。

RxJava has .onBackpressureBuffer() operator, but RxSwift does not support it yet. RxJava具有.onBackpressureBuffer()运算符,但RxSwift尚不支持它。

Perhaps you can copy Java implementation of it. 也许您可以复制它的Java实现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM