From eb8a83d776441839c7b4c17d807525703bdbbffa Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Wed, 20 Oct 2021 00:14:26 +0200 Subject: [PATCH] Eros: do don't run create on UI thread --- .../plugins/pump/omnipod/eros/history/ErosHistory.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/history/ErosHistory.kt b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/history/ErosHistory.kt index 90d1a82ee3..e95f9d6357 100644 --- a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/history/ErosHistory.kt +++ b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/history/ErosHistory.kt @@ -22,10 +22,10 @@ class ErosHistory(private val dao: ErosHistoryRecordDao) { return if (record is ValueWrapper.Existing) record.value else null } - fun create(historyRecord: ErosHistoryRecordEntity?) { - // no need for rowId, but lose warnings in IDE and make sure transaction is completed. - val rowId = Single.just(dao.insert(historyRecord!!)).blockingGet() - } + fun create(historyRecord: ErosHistoryRecordEntity?): Long = + Single.just(dao.insert(historyRecord!!)) + .subscribeOn(Schedulers.io()) + .blockingGet() } @Suppress("USELESS_CAST")