private async Task UpdateScheduleAsync(TeamActivityModel activityModel, DeltaModel <ShiftModel> delta) { // apply the final delta to the current version of the savedShifts ensuring that no // other process can update it while we do so - N.B. the minimum lease time is 15s, the // maximum lease time is 1m var savedShifts = await _scheduleCacheService.LoadScheduleWithLeaseAsync(GetSaveScheduleId(activityModel.TeamId), activityModel.StartDate, new TimeSpan(0, 0, _options.StorageLeaseTimeSeconds)); delta.ApplyChanges(savedShifts.Tracked); delta.ApplySkipped(savedShifts.Skipped); await _scheduleCacheService.SaveScheduleWithLeaseAsync(GetSaveScheduleId(activityModel.TeamId), activityModel.StartDate, savedShifts); }
protected virtual async Task UpdateSavedRecordsAsync(TeamActivityModel activityModel, CacheModel <T> savedRecords, DeltaModel <T> delta) { delta.ApplyChanges(savedRecords.Tracked); delta.ApplySkipped(savedRecords.Skipped); await SaveRecordsAsync(activityModel, savedRecords).ConfigureAwait(false); }