public IActionResult Details(long? Id) { if (Id == null) { return NotFound(); } var result = _jobDefinitionService.GetJobDefinition(Convert.ToInt64(Id)); var userProfileId = User.Identity.GetUserProfileId(); result.Value.Adapters = _selectList.GetList<AdapterSelectListModel>(userProfileId ?? default(long)); var model = result.Value; return PartialView("_DetailsPartial", model); }
private Task <IJobId> ScheduleAsync(IJob job, Func <IBackgroundJobClient, JobDefinition, string, string> schedule) { var jobDefinition = _jobDefinitionService.GetJobDefinition(job.GetType()); var json = _jsonSerializer.Serialize(job); var id = schedule(_backgroundJobClient, jobDefinition, json); _log.Verbose($"Scheduled job '{id}' in Hangfire"); return(Task.FromResult <IJobId>(new HangfireJobId(id))); }
public async Task <IJobId> ScheduleNowAsync(IJob job, CancellationToken cancellationToken) { var jobDefinition = _jobDefinitionService.GetJobDefinition(job.GetType()); var json = _jsonSerializer.Serialize(job); _log.Verbose(() => $"Executing job '{jobDefinition.Name}' v{jobDefinition.Version}: {json}"); // Don't schedule, just execute... await _jobRunner.ExecuteAsync(jobDefinition.Name, jobDefinition.Version, json, cancellationToken).ConfigureAwait(false); return(JobId.New); }