File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
src/SiteMonitor/ViewModels Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ namespace SiteMonitor.ViewModels;
2222/// </summary>
2323public partial class MainWindowViewModel : ViewModelBase {
2424 private DateTime ? _apiDownSince ;
25+ private DateTime ? _noChatSince ;
2526 [ ObservableProperty ] private bool _apiUp = true ;
2627
2728 [ ObservableProperty ] private string ? _chatTimestamp ;
@@ -162,6 +163,7 @@ private async Task PingSite() {
162163 ( HttpStatusCode , string ? ) chat = await SendGetRequest ( "https://nullinside.com/twitch-bot/v1/bot/chat/timestamp" ) . ConfigureAwait ( false ) ;
163164 bool chatNotUpdating = false ;
164165 if ( HttpStatusCode . OK == chat . Item1 && null != chat . Item2 ) {
166+ _noChatSince = null ;
165167 ChatTimestamp = chat . Item2 ;
166168 string parsed = ChatTimestamp . Trim ( '"' ) ;
167169 if ( DateTime . TryParse ( parsed , out DateTime time ) ) {
@@ -173,8 +175,9 @@ private async Task PingSite() {
173175 }
174176 }
175177 else {
178+ _noChatSince = _noChatSince ?? DateTime . Now ;
176179 ChatTimestamp = null ;
177- chatNotUpdating = true ;
180+ chatNotUpdating = DateTime . Now - _noChatSince > Constants . MAX_TIME_WITHOUT_CHATS ;
178181 }
179182
180183 _apiDownSince = ! WebsiteUp || ! ApiUp || ! NullUp ? _apiDownSince ?? DateTime . Now : null ;
You can’t perform that action at this time.
0 commit comments