public JobBase BeginSyncJob( SyncTriggerType syncTriggerType, AnalyzeRelationshipResult previousResult) { if (this.ActiveJob != null) { throw new InvalidOperationException("An ActiveJob is already present."); } if (previousResult == null) { AnalyzeJob newAnalyzeJob = new AnalyzeJob(this); newAnalyzeJob.ContinuationJob = new SyncJob(this, newAnalyzeJob.AnalyzeResult) { TriggerType = syncTriggerType }; newAnalyzeJob.Started += this.JobStarted; newAnalyzeJob.Finished += this.JobFinished; newAnalyzeJob.ContinuationJob.Started += this.JobStarted; newAnalyzeJob.ContinuationJob.Finished += this.JobFinished; newAnalyzeJob.Start(); return(newAnalyzeJob); } SyncJob newJob = new SyncJob(this, previousResult) { TriggerType = syncTriggerType }; newJob.Started += this.JobStarted; newJob.Finished += this.JobFinished; newJob.Start(); return(newJob); }
/// <summary> /// Notifies synchronizer that an event occured that should trigger synchronization /// at the nearest convenient time. /// </summary> /// <param name="syncTriggerType">Reason for the synchronization request for logging</param> public void RequestSynchronization(SyncTriggerType syncTriggerType) { if (!_blockTree.CanAcceptNewBlocks) { return; } if (_logger.IsDebug) { string message = $"Requesting synchronization [{syncTriggerType.ToString().ToUpperInvariant()}]"; if (syncTriggerType == SyncTriggerType.SyncTimer) { _logger.Trace(message); } else { _logger.Debug(message); } } _syncRequested.Set(); }
public void StartSyncJob(SyncTriggerType triggerType) { this.BaseModel.BeginSyncJob(triggerType, null); }