I am trying to understand the difference between c...
# coroutines
a
I am trying to understand the difference between calling cancelAndJoin and complete() on a CompletableJob during shutdown. Can anyone explain the difference?
p
Well, one completes it successfully, the other cancels it and it’s children. One joins, other doesn’t If there are children, .complete will transition to “completing” state before “completed”. So you might want to join after complete if that’s important Check the state machine on JobSupport kdoc
a
hm so it seems like cancelAndJoin is the right thing for my project.. I just also see ktor making "complete" calls on shutdown in some areas - for websockets for instance so am trying to understand when that would be the right thing. thanks for the pointers