consulo / UnityEditorConsuloPlugin

Consulo plugin for UnityEditor
Apache License 2.0
18 stars 2 forks source link

CPU spike when Consulo is closed. #14

Closed brogan89 closed 3 years ago

brogan89 commented 5 years ago

Hey was getting massive cpu spikes when in Unity play mode. Consulo wasn't opened, so opening the Consulo project fixed it. I looks like a regression from issue #100

spike-consuloclosed

It look like it is because of this section https://github.com/consulo/UnityEditorConsuloPlugin/blob/035bfe62e0d69fc6059161454698126ded85c36b/Sources/ConsuloIntegration.cs#L244

VISTALL commented 5 years ago

Hello. Oh. I known that code - but not expect problem like this.

I have no idea how good rewrite it for now.

Consulo path is not stable (user can change it). Also - consulo settings paths can be changed.

For now - it's trying send to stable port of Consulo REST API.

Thanks. I will think about that problem

brogan89 commented 5 years ago

I am not too sure about code so I am only guessing when saying this, but would it be better to set up a UDP broadcasting system rather than Socket connection. It doesn't even look like the socket is being used once socket is connected since in using(). UDP you can just send messages to localhost:port and it doesn't matter if there is listener or not which it looks you are kind of doing here https://github.com/consulo/UnityEditorConsuloPlugin/blob/035bfe62e0d69fc6059161454698126ded85c36b/Sources/ConsuloIntegration.cs#L197 but im guessing this is TPC by default which requires a response.

Otherwise, it might be better to just check if process is running. This will be faster as you don't need to wait for Socket connection. https://stackoverflow.com/questions/262280/how-can-i-know-if-a-process-is-running

I'm not expert in networking however, so take my suggestion with grain of salt :)

VISTALL commented 5 years ago

About code - it's always request body in WriteCallback.

About process list - i forgot why i don't use it (it was an option - but i refused it)

Thanks

VISTALL commented 5 years ago

Hello. Again. I am working at migration to Asset Store, and testing new functional via process list.

There a problem. Process can't access to admin processes (for example unity run with user rights, consulo with admin rights).

I add code searching via process list, but socket search exists too (but i will add preprocessor variable for disabling this logic CONSULO_DISABLE_SOCKET_SEARCHING or via menu item)

Thanks