doOnBeforeTerminate

fun <T> Single<T>.doOnBeforeTerminate(action: () -> Unit): Single<T>

Calls the action when the Single signals a terminal event: either onSuccess or onError. The action is called before the observer is called.

Please refer to the corresponding RxJava document.