Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import graphql.GraphQLContext
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.FlowPreview
import kotlinx.coroutines.Job
import kotlinx.coroutines.job
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.delay
Expand Down Expand Up @@ -82,6 +83,10 @@ abstract class GraphQLWebSocketServer<Session, Message>(
closeSession(session, GraphQLSubscriptionStatus.CONNECTION_INIT_TIMEOUT)
}
}

(session as? CoroutineScope)?.coroutineContext?.job?.invokeOnCompletion {
subscriptions.values.forEach(Job::cancel)
}

requestParser.parseRequestFlow(session)
.map { objectMapper.readValue<GraphQLSubscriptionMessage>(it) }
Expand Down
Loading