public void UpdateLastCreatedSyncDate(DateTime maxDateCreated) { var syncParams = _syncRepository.GetSyncParams(); syncParams.TraineeshipLastCreatedDate = maxDateCreated > syncParams.TraineeshipLastCreatedDate ? maxDateCreated : syncParams.TraineeshipLastCreatedDate; _syncRepository.SetTraineeshipSyncParams(syncParams); }
public void Process(CancellationToken cancellationToken) { var syncParams = _syncRepository.GetSyncParams(); if (syncParams.IsValidForAuditIncrementalSync) { ExecuteIncrementalSync(syncParams, cancellationToken); } else { ExecuteFullSync(syncParams, cancellationToken); } }
private void ExecuteProcessor(IMigrationProcessor migrationProcessor, CancellationToken cancellationToken) { _logService.Info($"Executing {migrationProcessor}"); try { var lastSyncVersion = _syncRepository.GetSyncParams().LastSyncVersion; if (lastSyncVersion.HasValue && lastSyncVersion > 0) { if (!cancellationToken.IsCancellationRequested) { migrationProcessor.Process(cancellationToken); } } } catch (FatalException) { throw; } catch (Exception ex) { _logService.Error("Error occurred. Sleeping before trying again", ex); } _logService.Info($"{migrationProcessor} executed"); }