public async Task <bool> CheckHealth() { // No need to re-start a faulty job, so returning "true". // Just update the state and save the error, if not already done by some other worker. var status = await JobStore.LoadStatus(TenantId, JobId); if (status.State >= JobState.Completed) { return(true); } if (!await JobStore.UpdateState(TenantId, JobId, status.State, JobState.Failed)) { return(true); } await JobStore.AddException(TenantId, JobId, BuildErrorData()); return(true); }