From fead92129dcf0c4439afc7829b38ccea39104efa Mon Sep 17 00:00:00 2001 From: Octol1ttle Date: Tue, 17 Oct 2023 17:25:15 +0500 Subject: [PATCH] Unschedule scheduled event status update only if last update was successful (#168) This PR fixes an issue that prevented scheduled event status updates from running again if they failed. This happened because, before each update, the events would be synchronized. The `ScheduleOnStatusUpdated` field would be set even if it's already `true`, which will cause it to be set to `false` for unsuccessful updates. The issue is fixed by surrounding the field set call with a condition that will prevent setting the field from `true` to `false` --- src/Services/Update/ScheduledEventUpdateService.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Services/Update/ScheduledEventUpdateService.cs b/src/Services/Update/ScheduledEventUpdateService.cs index 1672e00..f1d3524 100644 --- a/src/Services/Update/ScheduledEventUpdateService.cs +++ b/src/Services/Update/ScheduledEventUpdateService.cs @@ -114,7 +114,11 @@ public sealed class ScheduledEventUpdateService : BackgroundService var eventData = data.ScheduledEvents[@event.ID.Value]; eventData.Name = @event.Name; eventData.ScheduledStartTime = @event.ScheduledStartTime; - eventData.ScheduleOnStatusUpdated = eventData.Status != @event.Status; + if (!eventData.ScheduleOnStatusUpdated) + { + eventData.ScheduleOnStatusUpdated = eventData.Status != @event.Status; + } + eventData.Status = @event.Status; } }