Bug 2036011 - Support cancellation for Bookmarks importing#241
Bug 2036011 - Support cancellation for Bookmarks importing#241segunfamisa wants to merge 1 commit intomozilla-firefox:autolandfrom
Conversation
|
Warning The base branch is currently set to |
|
View this pull request in Lando to land it once approved. |
Correct lando link: https://lando.moz.tools/pulls/firefox-autoland/241 |
| val minimumWait = async { delay(1.seconds) } | ||
| val result = async { importer.importBookmarksFromUri(action.uri) } | ||
|
|
||
| // We want to make sure we stay in the loading state for at least one second | ||
| // during an import to prevent the dialog from flashing before the user can | ||
| // comprehend what is currently happening. | ||
| val minimumWait = async { delay(1.seconds) } | ||
| val result = async { importer.importBookmarksFromUri(action.uri) } | ||
| awaitAll(minimumWait, result) | ||
|
|
||
| awaitAll(minimumWait, result) | ||
| result.await() | ||
| .onFailure { store.dispatch(ImporterAction.ImportFailed) } | ||
| .onSuccess { store.dispatch(ImporterAction.ImportFinished(it.count)) } |
There was a problem hiding this comment.
I'm not sure this block will play well with cancellation, because if the insertion completed earlier than 1s, there's nothing to cancel.
I think it's a very short window, so I hope it's not going to be a frequent edge case.
There was a problem hiding this comment.
I think this ok. It's very easy to delete the folder after the import if they want to.
| */ | ||
| @OptIn(ExperimentalStdlibApi::class) | ||
| internal val CoroutineScope.dispatcher: CoroutineDispatcher | ||
| get() = coroutineContext[CoroutineDispatcher] ?: Dispatchers.IO |
# Conflicts: # mobile/android/android-components/components/lib/bookmarks-file/src/test/java/mozilla/components/lib/bookmarks/file/HtmlBookmarksFileImporterTest.kt
6b729d7 to
d85bc41
Compare
|
Running another try after rebasingn & resolving conflicts: https://treeherder.mozilla.org/jobs?repo=try&landoInstance=lando-prod-2025&landoCommitID=42048 |
|
Pull request closed by commit 0732687 |
No description provided.