mirror of
https://github.com/techgarage-ir/MTWireGuard.git
synced 2025-08-29 06:18:08 +02:00
Fix random crash
This commit is contained in:
parent
393da2a352
commit
331c83d7f9
1 changed files with 5 additions and 9 deletions
|
@ -154,14 +154,6 @@ namespace MTWireGuard.Application
|
|||
lastKnown.TX = old.TX;
|
||||
lastKnown.CreationTime = DateTime.Now;
|
||||
dbContext.LastKnownTraffic.Update(lastKnown);
|
||||
//if (lastKnown != null)
|
||||
//{
|
||||
// dbContext.LastKnownTraffic.Update(lastKnown);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// await dbContext.LastKnownTraffic.AddAsync(lastKnown);
|
||||
//}
|
||||
item.ResetNotes = $"System reset detected at: {DateTime.Now}";
|
||||
await dbContext.DataUsages.AddAsync(item);
|
||||
}
|
||||
|
@ -181,9 +173,13 @@ namespace MTWireGuard.Application
|
|||
await dbContext.SaveChangesAsync();
|
||||
transaction.Commit();
|
||||
}
|
||||
catch (DbUpdateException ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
transaction.Rollback();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
transaction.Rollback();
|
||||
Console.WriteLine(ex.Message);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue