Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StateHistoryDto.StateName is "Processing" in ContinueJobWith #2430

Open
marcinjahn opened this issue Aug 6, 2024 · 0 comments
Open

StateHistoryDto.StateName is "Processing" in ContinueJobWith #2430

marcinjahn opened this issue Aug 6, 2024 · 0 comments

Comments

@marcinjahn
Copy link

marcinjahn commented Aug 6, 2024

When I set up continuation of my job, I'd expect JobStorage.Current.GetMonitoringApi().JobDetails.History to contain a state where the job is "Succeeded" (in happy path). However, it randomly happens that the latest entry there is "Processing".
Is it expected?

Here's simplified version of my code:

var state = new EnqueuedState("my-queue");
var jobId = client.Create<MyJob>(
    job => job.Run(cancellationToken),
    state
);

client.ContinueJobWith(
    jobId,
    () => DoSomething(jobId),
    state
);

public async Task DoSomething(sting jobId)
{
    var jobDetails = JobStorage.Current.GetMonitoringApi().JobDetails(jobId);

    var lastJobState = jobDetails.History.OrderByDescending(state => state.CreatedAt).First();

    _logger.log(lastJobState.StateName); // logs "Processing" for some jobs
}

If I'm doing something wrong, what's the proper way to get the job's state and timestamp of its finished execution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant