simple-store icon indicating copy to clipboard operation
simple-store copied to clipboard

putString when wrapped with Completable.fromFuture() seems to run immediately

Open akvashi opened this issue 6 years ago • 3 comments

Describe the bug putString when wrapped with Completable.fromFuture() seems to run immediately. Verified via debugger.

Maybe be specific to the instance when checking for said key before writing to SimpleStore

To Reproduce Code Setup:

val setValue = Completable.fromFuture(simpleStore.putString(key, value))
val checkKeyFirst = Single.fromFuture(simpleStore.containsSingle(key))
checkKeyFirst.flatMapCompletable { isSet -> 
    if(isSet){ throw IllegalStateException() } else { setValue }
}

Expected behavior Value should only be placed in SimpleStore when Completable has been subscribed to

Smartphone (please complete the following information):

  • Device: various
  • OS: Android 10

akvashi avatar Oct 28 '19 22:10 akvashi

I realize after writing this that this maybe an issue within Rx. Either way I think its important to highlight the issue in case anyone else runs into it.

akvashi avatar Oct 28 '19 22:10 akvashi

If a failing unit test can be written, that would be great.

kurtisnelson avatar Jun 14 '20 18:06 kurtisnelson

a failing unit test can be written and called in a separate project

mcadamsx avatar May 13 '22 09:05 mcadamsx