Skip to content

Issue #116 : Dispatch network calls to io dispatcher.#130

Open
lukjj-public-pega wants to merge 1 commit intomasterfrom
issue/116
Open

Issue #116 : Dispatch network calls to io dispatcher.#130
lukjj-public-pega wants to merge 1 commit intomasterfrom
issue/116

Conversation

@lukjj-public-pega
Copy link
Copy Markdown
Contributor

Idea behind this one is to move network related calls (like finding delegate, etc) to the IO dispatcher as requested in #116 . This is done as launch(context:) call so this will be removed once mainScope is cancelled.

@lukjj-public-pega lukjj-public-pega requested a review from a team as a code owner April 7, 2026 10:08
mainScope().launch(Dispatchers.IO) {
try {
Log.i(TAG, "Starting WKURLScheme task. <${startURLSchemeTask.request.URL}>")
val (data, response) = send(startURLSchemeTask.request)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please consider wrapping only send invocation with Dispatchers.IO :

val (data, response) = withContext(Dispatchers.IO) {
      send(startURLSchemeTask.request)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By doing this we would dispatch actual request handling to the IO thread pool - but rest of the work would be still done on the main thread - so we would not need NSLocks to synchronize tasks access.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants