https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
reaktive
  • l

    lehakorshun

    02/14/2020, 3:15 PM
    ok 🙂 I faced with the problem, how can I call extension methods from swift. I know it isn’t good, but right now I need it. I saw an issue about it on github, but I haven’t found a solution.
    a
    • 2
    • 4
  • m

    Mina Eweida

    03/08/2020, 12:22 PM
    Hi, I have a small question just to be safe:
    val singleScheduler = createSingleScheduler()
            singleScheduler.newExecutor().submit {
                // do something
            }
    Does everytime I do
    newExecutor().submit
    here ensure it will run on the same thread like in java concurrent when we use
    Executors.newSingleThreadExecutor()
    ?
    a
    • 2
    • 4
  • m

    Mina Eweida

    04/13/2020, 6:41 PM
    Hi, I was reading about not using Ktor coroutines-interop
    Ktor does not work well in multithreaded environment in Kotlin/Native (it may crash), so please don’t mix Ktor and 
    coroutines-interop
    My question is, does it crash with a specific type of request i.e. get, post? Because my use case is simply fire and forget a post request, I am not expecting any response. So does it crash because of multithreading and sharing results or crashes were reported on firing requests in general?
    a
    • 2
    • 1
  • s

    saket

    04/20/2020, 6:00 AM
    Okay something definitely changed in 1.3.71 related to how the compiler args are read: https://kotlinlang.slack.com/archives/C3SGXARS6/p1585552724076400
    a
    • 2
    • 1
  • s

    saket

    04/24/2020, 10:20 PM
    I can’t tell why, but IntelliJ is unable to resolve dependencies from
    reaktive
    in my macOS platform code. All other dependences are working fine.
    a
    • 2
    • 38
  • s

    saket

    04/25/2020, 7:15 PM
    Have there been any discussions around exposing Combine extensions for reaktive streams?
    a
    • 2
    • 11
  • j

    Jeff Beyond

    04/27/2020, 10:50 AM
    When I read Reaktive source code, I don't quite understand what the role of the BufferedExecutor class is? Could anyone help me explain?
    a
    • 2
    • 2
  • o

    Omar Mainegra

    04/30/2020, 4:31 PM
    Hi everyone, I'm investigating an issue with
    debounce
    in iOS, for some reason is NOT waiting the
    timeout
    @Test
    fun `'debounce' using Main scheduler works`() {
        val timeout = 10L
        val time = getTimeMillis()
        val wasCalled = AtomicBoolean(false)
    
        observableOf(1, 2, 3, 4, 5)
            .debounce(timeout, mainScheduler)
            .subscribe { value ->
                val elapsed = getTimeMillis() - time
                assertTrue("Should have passed more than $timeout millis, but was $elapsed") { elapsed >= timeout }
                assertEquals(5, value)
    
                wasCalled.value = true
            }
    
        await(2*timeout.toInt())
        assertTrue("`subscribe` was not called") { wasCalled.value }
    }
    The test fails
    kotlin.AssertionError: Should have passed more than 10 millis, but was 1
    But it works with
    ioScheduler
    and
    computationScheduler
    ,
    also if
    delay
    is used instead of
    debounce
    it works as well. PS: The
    await
    functions just runs the current Loop:
    private fun await(millis: Int) {
        NSRunLoop.currentRunLoop.runUntilDate(NSDate.dateWithTimeInterval(millis.toDouble()/1000.0, NSDate.now))
    }
    a
    • 2
    • 28
  • s

    saket

    05/01/2020, 5:11 AM
    I can’t get
    export
    to work for my project ¯\_(ツ)_/¯
    a
    • 2
    • 9
  • m

    molikto

    05/01/2020, 6:04 AM
    hello. It seems Android build variant other than debug&release will resolve the dependency to
    -jvm
    a
    • 2
    • 2
  • s

    saket

    05/22/2020, 11:51 PM
    Is anyone using ktor + reaktive on native targets? What does your setup look like and have you run into any issues?
    a
    o
    • 3
    • 12
  • o

    Omar Mainegra

    05/29/2020, 4:14 PM
    Hi @Arkadii Ivanov, I'm investigating some test cases taking too long in iOS, and I narrowed it to
    concatMap
    . This is what I found
    @Test
    fun Operator_durations() {
        val concatMapDuration = measureTime {
            (1..100).asObservable().concatMap { (1..100).asObservable() }.test().values
        }
        val flatMapDuration = measureTime {
            (1..100).asObservable().flatMap { (1..100).asObservable() }.test().values
        }
    
        println("Measured: concatMap=$concatMapDuration, flatMap=$flatMapDuration")
    }
    Output
    [iOS] Measured: concatMap=7.68s, flatMap=7.47s
    [JVM] Measured: concatMap=122ms, flatMap=36.6ms
    [JS ] Measured: concatMap=241ms, flatMap=147ms
    As you can see iOS time is a magnitude higher
    a
    • 2
    • 29
  • m

    Mananpoddarm

    06/02/2020, 11:39 AM
    is it possible to use rxjs in kotlin multiplatform platform specific definitions?
    a
    • 2
    • 3
  • o

    Omar Mainegra

    06/11/2020, 4:06 PM
    Hi @Arkadii Ivanov, Is there a reason
    TestObservable
    freezes? I'm been forced to use atomics instead of regular `var`s (i.e. to capture values, etc.) otherwise I get
    InvalidMutabilityException
    , if I remove it everything works fine. At least could it be optional? like
    TestObservableObserver(autoFreeze)
    a
    • 2
    • 42
  • m

    Mina Eweida

    06/18/2020, 3:18 PM
    Hi @Arkadii Ivanov I have a question regarding the fix regarding javascript https://github.com/badoo/Reaktive/pull/486 When it gets approved and merged, when will you plan to release it?
    a
    • 2
    • 20
  • a

    Arkadii Ivanov

    06/19/2020, 3:05 PM
    Reaktive 1.1.15 is out: • Fixed 
    MainScheduler
     crash with 
    ReferenceError
     in Node.js (#486 by @minaEweida)
    m
    • 2
    • 2
  • m

    Mina Eweida

    06/21/2020, 12:09 PM
    Hi @Arkadii Ivanov is there any plans to publish Reaktive to npm? Recently we used reaktive in our lib to support node.js apps so we are publishing reaktive to our internal artifactory since it is not on npm.
    a
    • 2
    • 2
  • s

    saket

    06/28/2020, 10:09 PM
    I ended up writing this:
    a
    • 2
    • 4
  • s

    saket

    06/28/2020, 10:40 PM
    unfortunately functions disguised as constructors aren’t obvious at all
    a
    • 2
    • 10
  • a

    aiidziis

    06/29/2020, 12:01 PM
    Has anyone tried writing Reaktive extensions for SqlDelight? I saw that they have
    coroutines, rxjava2 ,rxjava3
    extensions.
    a
    • 2
    • 8
  • s

    saket

    07/01/2020, 10:47 PM
    is there a
    Completable#blockingAwait()
    operator?
    a
    • 2
    • 3
  • s

    saket

    07/09/2020, 3:08 AM
    should
    Subject.Status
    be internal?
    a
    • 2
    • 4
  • w

    wellingtoncosta

    07/16/2020, 4:04 PM
    Hi! How can I use
    reaktive
    with
    ktor
    for http calls?
    a
    s
    • 3
    • 16
  • a

    Arkadii Ivanov

    07/17/2020, 8:20 PM
    Reaktive 1.1.16 is out! • Added 
    Completable.blockingAwait()
     operator (#497) • Added 
    getValue
     and 
    setValue
     extensions for atomics delegation (#496) • Added KDocs for interfaces with factory functions (#495) • Added 
    Emitter.setCancellable {}
     extension function (#503) • Added 
    TestScheduler.isManualProcessing
     variable property (#506) • Fixed a bug when some collection-based operators did not complete when the collection is empty (#501 by @amihusb)
    🎉 5
    s
    • 2
    • 7
  • o

    Omar Mainegra

    08/06/2020, 6:50 PM
    Hi @Arkadii Ivanov Does
    blockingGet()
    work in
    JS
    ? I have
    Test
    fun test_blockingGet() {
        val value = single<Int> { emitter -> emitter.onSuccess(1) }.blockingGet()
        println(value)
    }
    And I'm getting:
    IllegalStateException: Condition is not supported in JavaScript
    	at IllegalStateException.init(../build/js/packages_imported/kotlin/1.3.72/kotlin/exceptions.kt:66)
    	at Lock.newCondition(../utils/src/jsMain/kotlin/com/badoo/reaktive/utils/lock/Lock.kt:18)
    	at <global>.blockingGet(../reaktive/src/commonMain/kotlin/com/badoo/reaktive/utils/lock/Various.kt:5)
    a
    • 2
    • 3
  • o

    Omar Mainegra

    08/06/2020, 8:51 PM
    Hi again 😄 Is there a way to convert from
    Single
    to a suspended function? I couldn't find anything in
    coroutines-interop
    module. Currently I'm doing
    val body = suspendCoroutine<String?> { continuation ->
        get("<https://postman-echo.com/get>", headers, query)
            .subscribe(
                onSuccess = { continuation.resume(it) }, 
                onError = { continuation.resumeWithException(it) } 
            )
    }
    It works in JVM and JS, but in Native I get
    kotlin.native.concurrent.FreezingException: freezing of $subscribe_2$<anonymous>_67$FUNCTION_REFERENCE$1621@e3e09f38 has failed, first blocker is EventLoopImpl@1c250dc8
    a
    • 2
    • 79
  • s

    saket

    08/06/2020, 8:53 PM
    is
    singleFromCoroutine
    what you’re looking for?
    o
    • 2
    • 7
  • a

    Arkadii Ivanov

    08/13/2020, 8:41 AM
    Hello. If somebody interested in
    coroutines-interop
    with mt coroutines, please check https://github.com/badoo/Reaktive/issues/304 It should be possible to publish a separate version. Please vote and/or respond. 🤘🚀
    👍 2
    m
    o
    • 3
    • 31
  • a

    Arkadii Ivanov

    08/18/2020, 3:05 PM
    Looks like there will be a version of Ktor compatible with mt coroutines 🙂 https://github.com/ktorio/ktor/commit/9785a7a82e89881ad279a77ac6adedfe621fb0b8
    🎉 1
    m
    • 2
    • 7
  • s

    saket

    08/18/2020, 7:35 PM
    can you share a gist of the optimization?
    a
    • 2
    • 4
Powered by Linen
Title
s

saket

08/18/2020, 7:35 PM
can you share a gist of the optimization?
a

Arkadii Ivanov

08/18/2020, 7:36 PM
What kind of gist?
s

saket

08/18/2020, 7:40 PM
as in a summary of the performance improvements you made
a

Arkadii Ivanov

08/18/2020, 7:42 PM
Before the PR a simple immutable list was used for back pressure queue in Kotlin/Native. This affected performance when the queue was growing. Now we use a custom implementation of the linked list based on atomic references: https://github.com/badoo/Reaktive/pull/508/files#diff-53986f5c93dcc883b87a5e3f6ab7bd95
s

saket

08/18/2020, 7:47 PM
gotcha, thanks for explaining!
👍 1
View count: 1