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

Cancel future when process is canceled #86

Merged
merged 1 commit into from
Feb 19, 2022

Conversation

KotlinIsland
Copy link
Contributor

First time contributor checklist

Contributor checklist

  • I am targeting the master branch (and not the release branch)
  • I am using the provided codeStyleConfig.xml
  • I have tested my contribution on these versions of PyCharm/IDEA:
  • PyCharm Community 2021.3.1
  • IntelliJ IDEA 2021.3.1
  • My contribution is fully baked and ready to be merged as is
  • I ensure that all the open issues my contribution fixes are mentioned in the commit message of my first commit
    using the Fixes #1234 syntax

Description

Ok, so basically I think the way that axync tasks are handled is kinda funky, I'm not 100% sure what's going on but I'm fairly certain that when the process manager cancels the process the checkCanceled method will throw a ProcessCanceledException and when it does we should then cancel the future, I believe this will improve performance.

Type of Changes

Type
🐛 Bug fix

@leinardi
Copy link
Owner

Hi @KotlinIsland, thank you for the PR. But just out of curiosity, did you measure any performance improvement or it is just a guess that this PR will improve performance?

@KotlinIsland
Copy link
Contributor Author

KotlinIsland commented Jan 22, 2022

I really can't remember tbh 😁.

About 6 months ago I messed all around with this plugin and made a bit of progress, but I can't remember what was what.

I think the issue this fixes is that the plugin uses 100% of the system resources or something. Because it's running hundreds of redundant instances of mypy on top of each other.

I'm probably not right though 😳.

Have you noticed this behaviour before?

@leinardi
Copy link
Owner

I see, but is this still relevant after #77? @intgr what do you think?

@intgr
Copy link
Collaborator

intgr commented Jan 23, 2022

This code path isn't used in the current "real-time scan" logic (I think it wasn't before #77 either).

But Async.whenFinished is still used in ScanFilesBeforeCheckinHandler, which is the "Before Commit" "Scan with Mypy" logic. If ProcessCanceledException can be thrown there, this change should indeed be an improvement.

@intgr
Copy link
Collaborator

intgr commented Jan 23, 2022

It's well possible that this change is all that was needed to fix the performance issues, and the rewrite to the ExternalAnnotator API (which has some small downsides) wasn't necessary. 🤦

@intgr
Copy link
Collaborator

intgr commented Feb 19, 2022

Anyway I think this is a worthwhile change and should be merged for the "Before Commit" code path at least.

After that it's possible to revert #77, although I'm not sure yet if we want to.

@leinardi leinardi merged commit 3da05cb into leinardi:release Feb 19, 2022
@leinardi
Copy link
Owner

After that it's possible to revert #77, although I'm not sure yet if we want to.

Yeah I'm not sure as well, but I have the feeling that the new implementation takes longer to show the violation compared to the old one. So, maybe, reverting would be worth. But needs to be tested to be sure.

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.

3 participants