Skip to content

Commit

Permalink
Merge pull request #57 from gendalf90/fix-metadata-parsing
Browse files Browse the repository at this point in the history
Fix metadata parsing error
  • Loading branch information
johnstoletov authored Sep 13, 2022
2 parents 881059e + b1fbc61 commit 626ec84
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/Horarium/Handlers/RunnerJobs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,30 @@ private async Task StartRunner()

private async Task<JobMetadata> GetReadyJob()
{
JobDb job = null;

try
{
var job = await _jobRepository.GetReadyJob(_machineName, _settings.ObsoleteExecutingJob);

if (job != null)
return job.ToJob(_jsonSerializerSettings);
job = await _jobRepository.GetReadyJob(_machineName, _settings.ObsoleteExecutingJob);
}
catch (Exception ex)
{
_horariumLogger.Error("Ошибка получения джоба из базы", ex);
}

if (job == null) return null;

try
{
return job.ToJob(_jsonSerializerSettings);
}
catch (Exception ex)
{
_horariumLogger.Error("Ошибка парсинга метаданных джоба", ex);

await _jobRepository.FailedJob(job.JobId, ex);
}

return null;
}

Expand Down

0 comments on commit 626ec84

Please sign in to comment.