Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Coroutines 1.6移行記録 / Tried to migrate Coroutines to 1.6

Coroutines 1.6移行記録 / Tried to migrate Coroutines to 1.6

Masatoshi Kubode

February 22, 2022
Tweet

More Decks by Masatoshi Kubode

Other Decks in Programming

Transcript

  1. ©2022 Wantedly, Inc.
    Coroutines 1.6 Ҡߦه࿥
    ϞόΠϧษڧձ Wantedly × νʔϜϥϘ
    2022/2/22 ٱอग़խढ़
    Photo by Andrii Ganzevych on Unsplash

    View full-size slide

  2. ©2022 Wantedly, Inc.
    XXXXBOUFEMZDPNJELVCPEF

    View full-size slide

  3. ©2022 Wantedly, Inc.
    $PSPVUJOFTͷมߋ఺
    "OESPJEͰҠߦͨ͠
    ,..ͰҠߦ͠Α͏ͱ͕ͨ͠Ͱ͖ͳ͔ͬͨ
    ·ͱΊ
    ࿩͢͜ͱ

    View full-size slide

  4. ©2022 Wantedly, Inc.
    $PSPVUJOFTͷมߋ఺

    View full-size slide

  5. ©2022 Wantedly, Inc.
    w LPUMJOYDPSPVUJOFTUFTUSFXPSL
    w .VMUJQMBUGPSNରԠ
    w ৽͍͠"1*ͷ௥Ճͱݹ͍"1*ͷ%FQSFDBUJPO
    w ,PUMJO/BUJWFOFXNFNPSZNPEFMJTOPX
    TVQQPSUFE
    $PSPVUJOFTͷมߋ఺
    https://github.com/Kotlin/kotlinx.coroutines/releases/tag/1.6.0

    View full-size slide

  6. ©2022 Wantedly, Inc.
    LPUMJOYDPSPVUJOFTUFTU

    View full-size slide

  7. ©2022 Wantedly, Inc.
    w $PSPVUJOFTΛςετ͠΍͘͢͢ΔϥΠϒϥϦ
    w %JTQBUDIFSTTFU.BJOSFTFU.BJO
    w 5FTU%JTQBUDIFS
    DPSPVUJOFTUFTU

    View full-size slide

  8. ©2022 Wantedly, Inc.
    %JTQBUDIFSTTFU.BJOSFTFU.BJO

    View full-size slide

  9. ©2022 Wantedly, Inc.
    %JTQBUDIFSTTFU.BJOSFTFU.BJO
    ϢχοτςετͰ͸ϞοΫ͕ඞཁʂ

    View full-size slide

  10. ©2022 Wantedly, Inc.
    %JTQBUDIFSTTFU.BJOSFTFU.BJO
    Dispatchers.MainΛஔ͖׵͑Δ

    View full-size slide

  11. ©2022 Wantedly, Inc.
    %JTQBUDIFSTTFU.BJOSFTFU.BJO
    Dispatchers.Main͕StandardTestDispatcherʹͳΔ

    View full-size slide

  12. ©2022 Wantedly, Inc.
    %JTQBUDIFSTTFU.BJOSFTFU.BJO
    σϑΥϧτʹ໭Δ

    View full-size slide

  13. ©2022 Wantedly, Inc.
    5FTU%JTQBUDIFS

    View full-size slide

  14. ©2022 Wantedly, Inc.
    5FTU%JTQBUDIFS
    ͦͷ··ͩͱςετͷ࣮ߦʹ1ඵ͔͔Δ

    View full-size slide

  15. ©2022 Wantedly, Inc.
    5FTU%JTQBUDIFS
    ςετͷ࣮ߦ͸ଈऴΘΔ

    View full-size slide

  16. ©2022 Wantedly, Inc.
    "OESPJEͰͷҠߦ

    View full-size slide

  17. ©2022 Wantedly, Inc.
    جຊతʹҠߦΨΠυ௨Γ
    "OESPJEͰͷҠߦ
    https://github.com/Kotlin/kotlinx.coroutines/blob/1.6.0/kotlinx-coroutines-test/MIGRATION.md
    $PSPVUJOFT $PSPVUJOFT
    SVO#MPDLJOH5FTU SVO5FTU
    5FTU$PSPVUJOF%JTQBUDIFS
    6ODPO
    fi
    OFE5FTU%JTQBUDIFS
    4UBOEBSE5FTU%JTQBUDIFS

    View full-size slide

  18. ©2022 Wantedly, Inc.
    5FTU%JTQBUDIFS

    View full-size slide

  19. ©2022 Wantedly, Inc.
    ,..ͰͷҠߦ

    View full-size slide

  20. ©2022 Wantedly, Inc.
    w ͭͷେ͖ͳ໰୊͕ى͖ͨ
    w ,UPSͱͷ૊Έ߹Θͤ
    w *MMFHBM4UBUF&YDFQUJPO%JTQBUDIFST.BJOJT
    VTFEDPODVSSFOUMZXJUITFUUJOHJU
    ,..ͰͷҠߦ

    View full-size slide

  21. ©2022 Wantedly, Inc.
    w ,PUMJO/BUJWF্Ͱ,UPSY$PSPVUJOFT
    Ͱ*OWBMJE.VUBCJMJUZ&YDFQUJPO͕ى͖Δ
    w ,UPSͷϦϦʔεΛ଴ͭඞཁ⏱
    ,UPSͷ໰୊
    https://youtrack.jetbrains.com/issue/KTOR-3463

    View full-size slide

  22. ©2022 Wantedly, Inc.
    w .VMUJQMBUGPSNରԠͨ͜͠ͱͰ௥Ճ͞Εͨྫ֎
    w %JTQBUDIFSTTFU.BJOSFTFU.BJOݺͼग़͠ͱ
    %JTQBUDIFST.BJO΁ͷΞΫηε͕ผεϨουͰ
    ಉ࣌ʹى͖Δͱൃੜ
    %JTQBUDIFST.BJOJTVTFEDPODVSSFOUMZXJUITFUUJOHJU

    View full-size slide

  23. ©2022 Wantedly, Inc.
    %JTQBUDIFST.BJOJTVTFEDPODVSSFOUMZXJUITFUUJOHJU

    View full-size slide

  24. ©2022 Wantedly, Inc.
    %JTQBUDIFST.BJOJTVTFEDPODVSSFOUMZXJUITFUUJOHJU
    ViewModelͷςετΛ͢Δ

    View full-size slide

  25. ©2022 Wantedly, Inc.
    %JTQBUDIFST.BJOJTVTFEDPODVSSFOUMZXJUITFUUJOHJU
    ςετͷBefore/AfterͰsetMain/resetMain

    View full-size slide

  26. ©2022 Wantedly, Inc.
    %JTQBUDIFST.BJOJTVTFEDPODVSSFOUMZXJUITFUUJOHJU
    Dispatchers.MainΛ࢖ͬͯΔ

    View full-size slide

  27. ©2022 Wantedly, Inc.
    %JTQBUDIFST.BJOJTVTFEDPODVSSFOUMZXJUITFUUJOHJU
    Dispatchers.Main = ςετεϨουͱผεϨου


    Ͱ࣮ߦ͞ΕΔ

    View full-size slide

  28. ©2022 Wantedly, Inc.
    %JTQBUDIFST.BJOJTVTFEDPODVSSFOUMZXJUITFUUJOHJU
    Dispatchers.MainͰ࣮ߦ͞ΕΔ
    ·Εʹྫ֎͕ى͖Δ

    View full-size slide

  29. ©2022 Wantedly, Inc.
    w ͢΂ͯͷίϧʔνϯ͕ফඅ͞ΕΔ͜ͱΛ֬ೝ͢Δ
    w ςετ͝ͱʹDBODFM͢Δ
    w 5FTU%JTQBUDIFSҎ֎࢖Θͳ͍
    w ཁ%*
    ๷͙ʹ͸

    View full-size slide

  30. ©2022 Wantedly, Inc.
    ·ͱΊ

    View full-size slide

  31. ©2022 Wantedly, Inc.
    w ओʹDPSPVUJOFTUFTUͷมߋ఺ʹ͍ͭͯ৮Εͨ
    w جຊతʹ͸ΨΠυ௨Γ
    w ᠘͸͋Δ
    w ,UPSͷϦϦʔεΛ଴ͭඞཁ
    ·ͱΊ

    View full-size slide

  32. ϖʔδλΠτϧ ϖʔδαϒλΠτϧ
    ©2022 Wantedly, Inc.
    🙇

    View full-size slide