public async Task <LapTelemetryDto> LoadLap(LapSummaryDto lapSummaryDto) { try { AddToActiveLapJob(); LapTelemetryDto lapTelemetryDto = null; await Task.Run(() => lapTelemetryDto = _cachedTelemetries.GetOrAdd(lapSummaryDto.Id, LoadLapTelemetryDto, lapSummaryDto)); _telemetryViewsSynchronization.NotifyLapLoaded(lapTelemetryDto); return(lapTelemetryDto); } catch (Exception ex) { Logger.Error(ex, "Error while loading lap telemetry"); return(null); } finally { RemoveFromActiveLapJob(); } }
public async Task <LapTelemetryDto> LoadLap(LapSummaryDto lapSummaryDto) { try { AddToActiveLapJob(); if (!_cachedTelemetries.TryGetValue(lapSummaryDto.Id, out LapTelemetryDto lapTelemetryDto)) { lapTelemetryDto = await Task.Run(() => _telemetryRepository.LoadLapTelemetryDtoFromAnySession(lapSummaryDto)); FillCustomDisplayName(lapTelemetryDto.LapSummary); _cachedTelemetries[lapTelemetryDto.LapSummary.Id] = lapTelemetryDto; } _telemetryViewsSynchronization.NotifyLapLoaded(lapTelemetryDto); RemoveFromActiveLapJob(); return(lapTelemetryDto); } catch (Exception ex) { Logger.Error(ex, "Error while loading lap telemetry"); return(null); } }