Skip to content

Make connection to Discord IPC smarter#2

Open
hyblocker wants to merge 3 commits into
OpenActionPlugins:mainfrom
hyblocker:main
Open

Make connection to Discord IPC smarter#2
hyblocker wants to merge 3 commits into
OpenActionPlugins:mainfrom
hyblocker:main

Conversation

@hyblocker
Copy link
Copy Markdown

I noticed the plugin in it's current state spams Discord IPC with oauth events. I made the re-initialisation handler take into account the current connection state and take into account whether or not re-initialisation succeeded or not.

@nekename
Copy link
Copy Markdown
Member

Hey @hyblocker! Sorry, I didn't realise that I wasn't watching these repos on orgs outside of my personal account, so I never got notified about PRs here :)

I'll take a look at this today

@nekename
Copy link
Copy Markdown
Member

Somehow, I don't think this PR actually changes anything at all. As soon as the client is set to Some (*discord_client().write().await = Some(client);), the reconnecting flag is immediately cleared (reconnecting_flag().store(false, Ordering::SeqCst);), which should already exit the reconnecting loop, making the additional check you added for whether the client is Some do nothing.

Am I wrong?

@nekename
Copy link
Copy Markdown
Member

In fact, the only thing I can see this changing is breaking the functionality for reconnecting when the client disconnects (https://github.com/hyblocker/opendeck-discord/blob/1a09ed89293120a6dbbda94fd6ecb7a1a0f5f7e3/src/rpc_events.rs#L40), as it'll skip the reconnect attempt as the client is Some but disconnected.

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.

2 participants