Skip to content

Commit 3ffd300

Browse files
fix: Long load times
Profiled the application and noticed that even though we're not awaiting the AddMessageCallback() it's still getting the UI thread stuck. Marshalling this to another thread since the class is thread-safe anyway. closes #31 closes #32
1 parent 6e509c1 commit 3ffd300

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/TwitchStreamingTools/ViewModels/Pages/ChatViewModel.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Linq;
44
using System.Reactive;
55
using System.Speech.Synthesis;
6+
using System.Threading.Tasks;
67

78
using Nullinside.Api.Common.Twitch;
89

@@ -176,7 +177,7 @@ public override void OnLoaded() {
176177
}
177178

178179
_selectedTwitchChatNames.Add(channel.TwitchChannel);
179-
_twitchClient.AddMessageCallback(channel.TwitchChannel, OnChatMessage);
180+
Task.Run(() => _twitchClient.AddMessageCallback(channel.TwitchChannel, OnChatMessage));
180181
}
181182
}
182183

0 commit comments

Comments
 (0)