public void Synchronize(SchedulerState state) { foreach (var streamState in statesProvider.GetStates()) { if (state.AllJobs.ContainsKey(streamState.Name)) { continue; } var newJob = state.AllJobs[streamState.Name] = jobFactory.CreateJob(streamState); jobLauncher.LaunchWaitJob(newJob, state); } }
public void HandleCompletedJob(Task completedJobTask, SchedulerState state) { if (completedJobTask is Task <SendingJobResult> sendingJobTask) { state.SendingJobs.Remove(completedJobTask); launcher.LaunchWaitJob(sendingJobTask.GetAwaiter().GetResult().Job, state); } if (completedJobTask is Task <WaitingJobResult> waitingJobTask) { state.WaitingJobs.Remove(completedJobTask); launcher.LaunchSendJob(waitingJobTask.GetAwaiter().GetResult().Job, state); } completedJobTask.GetAwaiter().GetResult(); }