Created
June 14, 2022 07:33
-
-
Save maor365scores/0f9c00248888de76e5ad73f765c1b524 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (update.CreateGame && createGamePriority != DataSourcesDAL.EPriorityLevel.Ignore) | |
{ | |
bool bWasDeleted = IsDeleted; | |
IsDeleted = false; | |
if (bWasDeleted && createGamePriority != DataSourcesDAL.EPriorityLevel.Neutral) | |
{ | |
CreateUpdate(update, EUpdateTypes.NewGame); | |
GamesDal.UpdateGameLastUpdateTime(ID, DateTime.UtcNow); | |
try | |
{ | |
// check if in the destination start time range there is already a game | |
long nOtherGame = Consts.NOT_GIVEN; | |
if (GamesDal.CheckIfGameExist(Competition.ID, StartTime, update.CompetitorsParsedIDs, | |
ID, out nOtherGame, Competition.RecognitionTimeSpan)) | |
{ | |
// Try to delete the game | |
CGame OtherGame = General.Games[nOtherGame]; | |
if (OtherGame != null) | |
{ | |
OtherGame.DeleteGame(); | |
} | |
} | |
} | |
catch (Exception e) | |
{ | |
ExceptionsHandler.HandleException(e); | |
} | |
} | |
else | |
{ | |
// Update last update time for this game, if wasn't updated for the last 5 minutes | |
// Todo: Make Async | |
if (!IsDeleted && DateTime.UtcNow.Subtract(LastUpdateTime) > TimeSpan.FromMinutes(5)) | |
{ | |
UpdateGameLastUpdateTime(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment