Repository navigation
ADFA-5340: Fix the top main-thread ANR hotspots #2122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
baa9523
style: spotless reformat, no functional change
hal-eisen-adfa 02e1f0a
ADFA-5340: Never block the main thread on terminal input
hal-eisen-adfa 574272a
ADFA-5340: Close indexing services off the main thread
hal-eisen-adfa 3a273d5
ADFA-5340: Move Kotlin LSP and log-sender teardown off the main thread
hal-eisen-adfa 18397ea
ADFA-5340: Clear output by replacing the editor content
hal-eisen-adfa 0789d12
ADFA-5340: Bound the build output editor
hal-eisen-adfa 1a28185
ADFA-5340: Cap build output batches
hal-eisen-adfa a77448a
ADFA-5340: Trim build output from the editor's own tail
hal-eisen-adfa 447ac31
ADFA-5340: Drop unsent terminal input when the session ends
hal-eisen-adfa d7fbc27
ADFA-5340: Keep a failed Kotlin compiler close from breaking later se…
hal-eisen-adfa 425c1a0
ADFA-5340: Bound the wait for a previous indexing close
hal-eisen-adfa a533db1
ADFA-5340: Disconnect log senders on their own threads
hal-eisen-adfa 4846c6e
ADFA-5340: Refresh output search after clearing
hal-eisen-adfa 8fd8f53
ADFA-5340: Append build output in bounded pieces
hal-eisen-adfa a57f5a8
ADFA-5340: Skip setup instead of reusing indexes a hung close still h…
hal-eisen-adfa 09ada19
ADFA-5340: Skip Kotlin setup when interrupted awaiting the previous c…
hal-eisen-adfa df48020
style: spotless reformat, no functional change
hal-eisen-adfa 84c629a
ADFA-5340: Walk log senders sequentially when snapshotting
hal-eisen-adfa 5359cef
ADFA-5340: Keep a final line longer than the output window
hal-eisen-adfa b7b2892
Merge branch 'stage' into bugfix/ADFA-5340
hal-eisen-adfa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
app/src/test/java/com/itsaky/androidide/services/log/LogSendersRegistryTest.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| package com.itsaky.androidide.services.log | ||
|
|
||
| import com.itsaky.androidide.logsender.ILogSender | ||
| import io.mockk.every | ||
| import io.mockk.mockk | ||
| import org.junit.Assert.assertEquals | ||
| import org.junit.Test | ||
|
|
||
| class LogSendersRegistryTest { | ||
| // disconnectAll fills a plain list from forEach; a parallel walk would race on it. | ||
| @Test | ||
| fun `forEach visits every sender on the calling thread`() { | ||
| val registry = LogSendersRegistry() | ||
| repeat(8) { i -> | ||
| val sender = | ||
| mockk<ILogSender> { | ||
| every { packageName } returns "pkg$i" | ||
| every { id } returns "id$i" | ||
| } | ||
| registry.put(CachingLogSender(sender, port = 0, isStarted = true)) | ||
| } | ||
|
|
||
| repeat(200) { | ||
| val threads = mutableSetOf<Thread>() | ||
| var visited = 0 | ||
| registry.forEach { | ||
| threads.add(Thread.currentThread()) | ||
| visited++ | ||
| } | ||
| assertEquals(setOf(Thread.currentThread()), threads) | ||
| assertEquals(8, visited) | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.