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

GameSettings, EnableDiscordService. #19343

Merged
merged 1 commit into from May 3, 2021

Conversation

anvilvapre
Copy link
Contributor

GameSettings.EnableDiscordService to allow users to manually edit the setting.yaml to disable the start of the Discord thread by mods that have the DiscordService trait.

Useful for players that do not use a local Discord client. And useful to be able to exclude the Discord thread from profiling reports. The thread shows up using 33% of CPU time.

@pchote
Copy link
Member

pchote commented Apr 12, 2021

The thread shows up using 33% of CPU time.

This sounds rather excessive. Do you have any idea what in that thread is using so much time?

@anvilvapre
Copy link
Contributor Author

anvilvapre commented Apr 12, 2021

See #19035

It aggressively tries to reconnect. The 33% CPU time may not be 'self' time but time spent waiting in a 'connect' call.

The DiscordRPC client does use a backoff period in reconnecting if an error occurs once - after - the connection was setup - if it was aborted. It seems it is not used when the connect call fails. Perhaps we could request this as feature.

An alternative solution is to listen for the connection failure event and after start a new RPC client only after a backoff period.

Main loop in RPC thread. Percentage is different now - I assume because of the impact of the logging thread.

     - 8.78% 0x7fc36b2e055e                                                                                           ▒
           0x7fc36b2e9841                                                                                              ▒
         - 0x7fc36b2e0442                                                                                              ▒
            - 8.75% instance void [DiscordRPC] DiscordRPC.RPC.RpcConnection::MainLoop()[Optimized]                     ▒
               - 8.75% instance bool [DiscordRPC] DiscordRPC.IO.ManagedNamedPipeClient::Connect(int32)[Optimized]      ▒
                  - 8.74% instance bool [DiscordRPC] DiscordRPC.IO.ManagedNamedPipeClient::AttemptConnection(int32,bool▒
                     - 8.74% 0x7fc36d3e1332                                                                            ▒
                        - 8.55% 0x7fc36d3e13f1                                                                         ▒
                           - 7.68% instance bool [System.IO.Pipes] System.IO.Pipes.NamedPipeClientStream::TryConnect(in▒
                              - 4.62% instance void [System.Net.Sockets] System.Net.Sockets.Socket::Connect(class [Syst▒
                                 - 4.33% instance void [System.Net.Sockets] System.Net.Sockets.Socket::DoConnect(class ▒
                                    - 1.41% 0x7fc3e4aeab4b                                                             ▒
                                       - 1.27% 0x7fc3e4b8c326                                                          ▒
                                          - 0.72% 0x7fc3e4b8c078                                                       ▒
                                               0.69% 0x7fc3e4b8bc7b                                                    ▒
                                    - 1.06% instance void [System.Private.CoreLib] System.Diagnostics.Tracing.EventSour▒
                                       - 1.06% instance void [System.Private.CoreLib] System.Diagnostics.Tracing.EventS▒
                                            0.83% instance void [System.Private.CoreLib] System.Diagnostics.Tracing.Act▒
                                      0.62% instance void [System.Private.CoreLib] System.Diagnostics.Tracing.EventSour▒
                              - 2.04% instance void [System.Net.Sockets] System.Net.Sockets.Socket::Dispose()[Optimized▒
                                 - 1.71% instance void [System.Net.Sockets] System.Net.Sockets.Socket::Dispose(bool)[Op▒
                                    - 1.29% instance void [System.Net.Sockets] System.Net.Sockets.SafeSocketHandle::Clo▒
                                       - 0.94% instance bool [System.Net.Sockets] System.Net.Sockets.SafeSocketHandle::▒
                                            0.70% instance valuetype [System.Net.Primitives]System.Net.Sockets.SocketEr▒
                                0.93% instance void [System.Net.Sockets] System.Net.Sockets.Socket::.ctor(valuetype [Sy▒

Copy link
Member

@Mailaender Mailaender left a comment

Choose a reason for hiding this comment

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

I think having a button to turn this off makes sense in any case.

@pchote pchote merged commit a5a371f into OpenRA:bleed May 3, 2021
@QmwJlHuSg9pa
Copy link

Any particular reason this isn't showing up as a checkbox under "Settings" -> "Advanced"? Expecting (changelog-observant) users to figure out that the "Game.EnableDiscordService" command option has an equivalent, unprinted key in "settings.yaml" is a bit of a stretch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants