Does each job execute after previous job's OnJobFailure handler?

I’m concerned about these lines:

function OnJobFailure(jobId)
  local job = ParseJson(RestApiGet("/jobs/" .. jobId))
  if job["Type"] == "DicomModalityStore" then
     local instanceId = job["Content"]["ParentResources"][1]

I want to fetch job details to grab instanceId and add it to local file to resend it later. Do i have guarantee that job is not deleted at the time of fetching according to JobsHistorySize?
For example If i set JobsHistorySize to 1000, and 5 instances failed and 1000 instances succeed after it, my first 5 failed jobs will be deleted and i can’t resume it or get instance id in job details.

If each job is executed after previous failed job callback (OnJobFailure), then we do have guarantee that RestApiGet(“/jobs/” … jobId) will return details.

No

Ok. Don’t you think it would be helpful to get job details alongside job id in future releases? so we don’t have to fetch it within the callback?

This feature is already part of the REST API. Check out the GET /jobs?expand resource.

Yes. But at the time we make request, this job can be deleted according to JobHistorySize, right ?

But if we get not only job id but job details in the callback, we don’t have to worry about job absence:

function OnJobFailure(jobId, jobDetails)
  # grab instance id from jobDetails to resend it later