Skip to content
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

Fix issues with Android Studio Koala sync #562

Closed
wants to merge 2 commits into from

Conversation

akerimsenol
Copy link

No description provided.

- And only use the wait for sync method on startup, as the manual sync triggers should be handled by the future provided by the API
- And don't rely on the UI to tell the status of sync as there can be progress indicators that have nothing to do with sync.

Signed-off-by: Ahmet Kerim Senol <[email protected]>
...as that doesn't seem to work anymore in headless mode.

It's fine to rely on the progress indicator instead when exiting.

Signed-off-by: Ahmet Kerim Senol <[email protected]>
@akerimsenol
Copy link
Author

@asodja please take a look.

CC @joshfriend

@joshfriend
Copy link
Contributor

(this is in reference to a bug I filed with android studio: https://issuetracker.google.com/issues/346618772)

waitOnPreviousGradleSyncFinish(project);
waitOnBackgroundProcessesFinish(project);
if (isStartup) {
waitOnStartupSyncToFinish(project);
Copy link
Member

@asodja asodja Jul 1, 2024

Choose a reason for hiding this comment

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

❓ How this behaves with all the indexing that happens after the sync now?

We deliberately used waitOnBackgroundProcessesFinish and waited on all processes to finish so also indexing was done before we triggered a next sync.

Copy link
Author

Choose a reason for hiding this comment

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

Waiting for indexing shouldn't be necessary as:

  1. Triggering a new sync will pause any indexing. (Though newer versions of IDEA do allow indexing while syncing. Though I think that's another discussion due to that behavior potentially also affecting the IDE time measurements of the profiler.)
  2. Indexing is not considered part of the measured values.

This might not be the all around best approach, but I think the current approach is error-prone and warrants changing. We have progress indicators for things like Firebase Test Lab (or Run configurations) that has nothing to do with indexing and I've seen those "block" the profiler for no reason.

Copy link
Member

@asodja asodja Jul 1, 2024

Choose a reason for hiding this comment

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

Gradle "work time" is measured via tooling api , so we actually get 3 numbers from these measurements:

  • Full sync time
  • Gradle work time
  • IDE work time: calculated as Full sync time - Gradle work time

So in that case indexing would count as IDE work time.

I think measuring full time (meaning additional idexing etc) that IDE needs to do project refresh is still useful, since that way we get better idea of real users experience.

I think it would be still nice we could wait on indexing to finish and not trigger sync before IDE has finish all it's work, since this always a big part of sync time.

Copy link
Member

Choose a reason for hiding this comment

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

Is there any better way to wait for indexing and other work to finish right after the sync?

Copy link
Author

Choose a reason for hiding this comment

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

I've asked this question on Jetbrains Slack, let's see if they have some guidance for us.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think measuring full time (meaning additional idexing etc) that IDE needs to do project refresh is still useful, since that way we get better idea of real users experience.

Yes that would be useful and I have been wondering how to measure this, however, gradle-profiler currently sometimes accidentally captures indexing which causes wild outliers in the data. Is this discussion about how to do that intentionally? If so, can that be a separate discussion so that this PR can be merged? I've tested this a few times with Koala and newer IDEs and it seems to work fine.

Copy link
Member

Choose a reason for hiding this comment

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

@akerimsenol did you get any response from Jetbrains?

@tinder-johnbuhanan2
Copy link

Just bumped into this :)

@asodja
Copy link
Member

asodja commented Nov 4, 2024

I merged #579 that should make profiling work with Koala and Ladybug. It takes an idea from this PR to only use the wait for sync method on startup sync and not manual sync, other changes are a bit different.

With that I will close this PR.

@asodja asodja closed this Nov 4, 2024
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.

5 participants