Generally if I'm making a network call with okhttp...
# lysine-dev
c
Generally if I'm making a network call with okhttp/retrofit and it takes a long time and I logout, how do I make sure that the responses don't get returned. I'm using suspend functions with retrofit and so I'm wonder if that'll just be cancelled automatically for me when I take down the containing class that's making the network calls to begin with. Basically just thinking about how cancellation works and how I can make sure everything cancels before I log out. I'm toying around with this of course in a small sample app to see if i can force this to actual happen with a bunch of concurrent network calls but yeah, just wanted to start the discussion. ive been doing some more kmp lately so ktor w/okhttp and so im curious on thought there too in case retrofit does something special with its suspend function definitions
j
I think this is a dependency injection problem, not an OkHttp problem
🫡 1
Whatever state and events your HTTP calls can trigger should be scoped to the login session
For example, if you have a SQLite database that HTTP calls can write to, the database file on disk and the connection in memory should both be scoped to the login session
j
To answer your specific question: yes, coroutine cancelation is wired correctly
🎉 2