|
@@ -111,7 +111,7 @@ public class GPSUpdateQueue
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
- Logger.Send(LogType.Error, "", string.Format("Unable to retrieve file: {0}", filename));
|
|
|
+ CoreUtils.LogException("", e, $"Unable to retrieve file: {filename}");
|
|
|
// File is probably in use.
|
|
|
}
|
|
|
if(deviceUpdate is not null)
|
|
@@ -124,9 +124,19 @@ public class GPSUpdateQueue
|
|
|
public void QueueUpdate(GPSDeviceUpdate deviceUpdate)
|
|
|
{
|
|
|
var filename = Path.Combine(QueuePath, $"{DateTime.UtcNow.Ticks} - {deviceUpdate.Location.Tracker.ID}");
|
|
|
-
|
|
|
- using var fileStream = new FileStream(filename, FileMode.OpenOrCreate, FileAccess.Write);
|
|
|
- Serialization.WriteBinary(deviceUpdate, fileStream, BinarySerializationSettings.Latest);
|
|
|
+ try
|
|
|
+ {
|
|
|
+ using var fileStream = new FileStream(filename, FileMode.OpenOrCreate, FileAccess.Write);
|
|
|
+ Serialization.WriteBinary(deviceUpdate, fileStream, BinarySerializationSettings.Latest);
|
|
|
+ }
|
|
|
+ catch(Exception e)
|
|
|
+ {
|
|
|
+ CoreUtils.LogException("", e);
|
|
|
+ if (File.Exists(filename))
|
|
|
+ {
|
|
|
+ File.Delete(filename);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public void QueueUpdate(string auditTrail, GPSTrackerLocation location) => QueueUpdate(new GPSDeviceUpdate
|