使用Anko协程扩展的正确方法是什么?

所以我正在从RxJava移植一个示例应用程序到Kotlin / Anko Corountines,我想知道如果我正在做它最好的(第一)方法:

fun getPopulationList() { val ref = asReference() async(UI) { try { ref().setCurrentState(ViewState.State.LOADING) val background = bg { repository.populationResponse().execute().body() } ref().let { it.response = background.await() it.mvpView?.onGetData(it.response) it.setCurrentState(ViewState.State.FINISH) } } catch (e: Exception) { e.printStackTrace() ref().mvpView?.onError(e) } } } 

我正在使用MVP架构,其中我的Presenter基类有一个CompositeSubscription和在onDestroy的片段或活动方法简单退订,并清除CompositeSubscription对象。 但是我想知道如果从asReference()函数是相同的,没有必要保存一个Deferred的列表,然后迭代它并逐个取消。

顺便说一句,如果我添加一个Thread.sleep(5000)来模拟一个大事务,并销毁碎片,我可以在logcat中看到的HTTP响应即使片段不可见/销毁,而RxJava没有发生,所以我想我我没有正确使用。