mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-01-31 09:09:00 +03:00
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`
This commit is contained in:
parent
580cd24810
commit
fead92129d
1 changed files with 5 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue