As from the title, it seems that a continuation job starts before the state of the previous job is saved in the storage.
That’s a problem when you want to use the output of a job as the input for the subsequent one. I’ve worked out my way to BackgroundJobStateChanger
private IState ChangeState(
StateChangeContext context, BackgroundJob backgroundJob, IState toState, string oldStateName)
{
using (var transaction = context.Connection.CreateWriteTransaction())
{
var applyContext = new ApplyStateContext(
context.Storage,
context.Connection,
transaction,
backgroundJob,
toState,
oldStateName);
var appliedState = _stateMachine.ApplyState(applyContext);
transaction.Commit();
return appliedState;
}
}
when the _stateMachine.ApplyState(applyContext);
the continuation job is enqueued before the transaction is committed, though the child job can’t reliable get the output of the previous one.