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: prevent channelPointRewardAdded invocation while connecting #4943

Closed

Conversation

iProdigy
Copy link
Contributor

@iProdigy iProdigy commented Nov 5, 2023

Follow-up PR 1/2 for #4942 - implements the mutex outlined in #3942 (comment)

Copy link
Contributor

@Nerixyz Nerixyz left a comment

Choose a reason for hiding this comment

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

How does this "Fix first redemption of a channel points reward not appearing in rare cases"?

Both TwitchChannel::addChannelPointReward and IrcMessageHandler::addMessage [must] run on the GUI thread - they can't run concurrently. I can only see this introducing a deadlock condition where the addMessage call in the callback would result in another callback being added.

I feel like the whole reward handling should be refactored, and the signal business should be removed. Maybe with a multimap/unordered_multimap of reward-id → pending messages?

@iProdigy
Copy link
Contributor Author

iProdigy commented Nov 5, 2023

Both TwitchChannel::addChannelPointReward and IrcMessageHandler::addMessage [must] run on the GUI thread - they can't run concurrently.

Ah, I assumed the signals weren't guaranteed to run on the same thread but this is wrong, closing.

I can only see this introducing a deadlock condition where the addMessage call in the callback would result in another callback being added.

That deadlock shouldn't happen since channelPointRewards_ would contain the reward, so another callback would not be created

I feel like the whole reward handling should be refactored, and the signal business should be removed. Maybe with a multimap/unordered_multimap of reward-id → pending messages?

I'm not opposed

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