Skip to content

Commit 165a501

Browse files
bug: fixing subscription issue with twitch client chat messages
When I modified the code to be channel specific I completely forgot that +=ing a delegate will append copies if you don't -= the item first. Fixed it now. The -= will ensure that only a single copy of the subscription is added to the chain.
1 parent 4c925fa commit 165a501

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/Nullinside.Api.Common/Twitch/TwitchClientProxy.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ public async Task AddMessageCallback(string channel, Action<OnMessageReceivedArg
188188
string channelSan = channel.ToLowerInvariant();
189189
lock (_onMessageReceived) {
190190
if (!_onMessageReceived.TryAdd(channelSan, callback)) {
191+
_onMessageReceived[channelSan] -= callback;
191192
_onMessageReceived[channelSan] += callback;
192193
}
193194
}

0 commit comments

Comments
 (0)