`persistentEntityRegistry.eventStream`是否真的需要至少约8-12秒才能被触发

时间:2018-06-22 12:15:58

标签: apache-kafka lagom

只想知道我的persistentEntityRegistry.eventStream花费大约8-12秒才能发射出来的可能原因是什么。

1 个答案:

答案 0 :(得分:1)

我刚刚发现它的卡桑德拉花了点时间。我所做的是将let callObserver = CXCallObserver() var didDetectOutgoingCall = false func showCallAlert() { guard let url = URL(string: "tel:+36201234567"), UIApplication.shared.canOpenURL(url) else { return } callObserver.setDelegate(self, queue: nil) didDetectOutgoingCall = false //we only want to add the observer after the alert is displayed, //that's why we're using asyncAfter(deadline:) UIApplication.shared.open(url, options: [:]) { [weak self] success in if success { DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { self?.addNotifObserver() } } } } func addNotifObserver() { let selector = #selector(appDidBecomeActive) let notifName = UIApplication.didBecomeActiveNotification NotificationCenter.default.addObserver(self, selector: selector, name: notifName, object: nil) } @objc func appDidBecomeActive() { //if callObserver(_:callChanged:) doesn't get called after a certain time, //the call dialog was not shown - so the Cancel button was pressed DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { [weak self] in if !(self?.didDetectOutgoingCall ?? true) { print("Cancel button pressed") } } } func callObserver(_ callObserver: CXCallObserver, callChanged call: CXCall) { if call.isOutgoing && !didDetectOutgoingCall { didDetectOutgoingCall = true print("Call button pressed") } } 设置为cassandra-query-journal.eventual-consistency-delay

我的参考文献如下:

https://groups.google.com/forum/#!topic/lagom-framework/cLXf6r5Ouw4 https://groups.google.com/forum/#!topic/akka-user/TH8hL-A8I4k/discussion